> I have a few File input fields in a form so people can upload images. If > there's an error with the form, I want to re-populate the fields with the > values the user filled in. This works for all the fields except the File > fields. When I check the HTML output to the browser, I do see that the > value > parameter (value="filename.jpg") is set for the File field, however, when > viewing the form the field appears blank. Also, if you leave it blank and > click Submit, I get an error stating it was empty, so, clearly the File > field is blank and not showing the default value that has been set. > > Is this my browser (IE 5.5 on Mac) or does a File field not accept default > values??
I'm pretty sure this doesn't work for security reasons. Otherwise, you could modify the value of the element with javascript when the form is submitted and actually upload any file from the users computer. For anything to be sent with a File field, the user has to click Browse and select the file. Maybe you could save the uploaded files somewhere in a temp folder and make the File fields hidden elements instead of actual file elements. The value of the hidden element would be the file you stored in temp. Be sure you validate this. It'd be better yet to store the file names in the session, let the user correct the other parts of the form, and then process everything. Hope that's not too confusing... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php