Hey, I have a form with which I take information about the user and a file. Then I insert them into database. What I want to achieve is that, I want to save the filename as the new ID inserted in MySQL database. I also have to validate the file to make sure it is of a specific type and size which I have done.
I only want to upload the file to my upload dir when everything is validated and it is okay to go. The 'action' attribute of my form refers to the same script.
1) So I want to know that if there are errors in other input fields but not in the file uploaded and then the form is submitted again, so will the file will be there? Or does it need to be uploaded again?
2) Second, I want to save the filename as the ID in MySQL database, but I also want to save the filename in MySQL database so whats the solution for this? The problem is I don't know what will be the new ID generated since it is auto-incremented. I can use the mysql_insert_id() function but then how do I save the filename in the table?
I guess everything is clear 🙂. Since English is not my native language, please ask if you don't understand what I mean.