NYCPHP Meetup

NYPHP.org

[nycphp-talk] $_FILES and form reloading

Michael Southwell michael.southwell at nyphp.org
Sat Nov 11 11:00:18 EST 2006


I have run into a problem with the $_FILES global and reloading a 
form when the user has omitted required information. Reloading the 
$_POST variables is no problem. But the form among other things 
offers the user a chance to upload a photo, and it is reloading that 
$_FILE information where I'm not succeeding. The relevant code is this:

<input name="photo1" type="file" class="style1" value="<?= 
$_FILES['photo1']['name'] ?>" />

print_r( $_FILES ) shows that $_FILES['photo1']['name'] exists, but 
it's not being shown in the input field.  What am I doing wrong?

Further than that, the name that exists is not fully qualified, so 
even if it were being displayed, I presume it wouldn't do any good 
upon the eventual successful submission of the form. How can I solve that?

By the way, it all works perfectly when the form doesn't need to be reloaded.


Michael Southwell, Vice President for Education
New York PHP
http://www.nyphp.com/training - In-depth PHP Training Courses 




More information about the talk mailing list