[thelist] PHP file upload problem

Bill Haenel mail at webmarketingworx.com
Thu Dec 4 23:08:10 CST 2003

This code works fine on my dev server. If there's a problem, I might
assume it's not in this code. 

Has your form changed? Do you have the attribute,
enctype="multipart/form-data" still in the form tag? If not, this will
cause empty $_FILES arrays.

You might try turning on some error messages to see if there's anything
popping up (if you haven't already).

You might also try putting the print_r before the rest of the code noted
below just to see if there's an error in the 'error' key for $_FILES.

Are you uploading large files? Is it timing out? Just a few other things
to consider.

You might want to post your form code here if you still can't find the
answer. Just so we can have a look at the whole package.

Sorry I couldn't be more help.


> if ($_FILES) { 
>     extract($_FILES['first'], EXTR_PREFIX_ALL, 'first');
>     if(is_uploaded_file($first_tmp_name)) {
>         if (!move_uploaded_file($first_tmp_name,
$location.$first_name)) {
>             echo "Upload failed.<br />Debugging information:<br />";
>             print_r($_FILES)."<br />\n";
>         }
>     } 
>     extract($_FILES['second'], EXTR_PREFIX_ALL, 'second');
>     if(is_uploaded_file($second_tmp_name)) {
>         if (!move_uploaded_file($second_tmp_name,
$location.$second_name)) {
>             echo "Upload failed.<br />Debugging information:<br />";
>             print_r($_FILES)."<br />\n";
>         }
>     } 
> }
> if 
> nothing is uploaded using either file field, $_FILES contains 
> both first and second arrays (both empty of data). For any 
> file that is uploaded, that array is empty. 
> --Liss

More information about the thelist mailing list