From: "Vincent DUPONT" <[EMAIL PROTECTED]> > I'd like your opinion on the best way to do a form > validation when the form contains a file upload object > (<input type="file">) > > When the form does not validate, I try to re-show all values > entered by the user.But, as far as I know, browsers do not > allow to set the default value (local file path) of a FILE component > I can get and display the default value in a label or text input, > but how could I upload that file then? Will I be limited to display > a warning message indicating that the user will have to select his/her file again??
You're not going to be able to fill it in for them. There's no way around that (which is a good thing). Solutions are to either notify them to select the file again and hope they notice, or keep the file in a temp directory when it's uploaded the first time and call it from there when the validation is successful. Simply remove the <input type="file"> from the form when you have the file, but make them correct / validate the rest of the data. Then, you know that if $_FILES is empty, you can search in the temp directory according to a hidden field / session value you've set to look for the file. Retrieve it from there and proceed as normal. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php