I am trying to write a script that will input data into a MySQL database from an HTML form. The form also allows the user to upload an image to go with the data being submitted.
When I use a form with just the file upload part, everything works fine. I can check that the file type is correct, upload the file, rename it according to a counter.txt file I use, resize it, etc.
As soon as I switch to the regular form, with all the textfields, etc. added, it croaks. Before it can even check for the right file type, PHP is re-naming the file to some random name and placing it in the temp dir. I have no problem with the temp dir itself, but the random name is making everything croak. Is there some way to work around that? I basically need to know what the file type is, and the substr line doesn't work on a file name with no extension, which is what the random generator is giving.