i know this topic has been covered before, but all of the solutions seem to deal with uploading the file after the image or file has been submitted in a form. my situation is somewhat different.
what i have is a mixed form where users submit info, and this is of course passed over to the next page as usual. here is where things differ from the norm: the next page validates the user input for errors and either redirects them to back to the first page to fix errors or proceed. (in the future the user will be asked for more information on the next page, but that is irrelevant for the moment.) if all of the user info checks out, the very last step is to write the image to a temporary folder.
on the next page (or wherever it will be later) the user info is entered into the database, a folder is created using the username, and the image name and path are changed so that the file now appears in the user folder. i did it this way so that only users who have completed registration will get a folder and image, and therefore not clutter my database with useless stuff.
all is good so far, but here is my problem: i cannot get the image path to write to the database. as i have mentioned, the image at this point is no longer associated with the original form that posted it, and the new path is now stored in a session variable containing the new file name and parent folder. i know the path works because the image will display if called up in a regular html img statement.
also, and this might be the giveaway for anyone who knows more about this than me, when i try to insert the path variable into the database with my other variables (name, email, etc) the user info is not entered into the database at all. however if i remove the path variable from my insert code, the other info is entered into a new user account as per normal – just no user image path.
i have tried several solutions including change the field type, but i get nothing at all. in the end i need the file in the user folder so that users can easily get to it, but i need the path to appear correctly in the database – since the file is already on the server i cannot see any difference between the file exsisting in the database or not, as long as i can get to wherever it is. later i will need to put multiple user images into an array or something and keep them organized, so i need to crack this.
(sorry for rambling on, but i’m just trying to give enough info up front.)