Jump to content

move_uploaded_file not working


BritSteve

Recommended Posts

Hi,

 

I am uploading a file from a form and trying to move it to another directory and it is not working, and I am not seeing any errors.

 

I am actually trying to move an xlsx file, but when that didn't work. I even tried a simple txt file and it still didn't work, so I don't think it is the file type.

 

This is my debug output.

 

new_move_filename is /home/xxxxxx/www/orders/admintest/xxxxxx/infiles/03042018085633.xlsx
ERROR: Unable to move xxxxx upload file to input directory /home/xxxxxx/www/orders/admintest/xxxxx/infiles!. Error is '' Check permissions and please try again.
Debug information
-----------------
Array ( [xxxx_file] => Array ( [name] => PO_Data_2017-03-22_14-44-07PST.xlsx [type] => application/vnd.openxmlformats-officedocument.spreadsheetml.sheet [tmp_name] => /tmp/phpLCxh0I [error] => 0 => 5980 ) )
 
The input directory does definitely exist, and I have tried 755 and 777 permissions.
 
Below is the code. I have x'd out some directory information for security reasons.
 
# Get a nice unique filename based on the date and time.
$filename_date_bit = date('mdYhis');
# Move file to xxxxx input directory.
$new_move_filename = $xxxx_indir . "/" . $filename_date_bit . ".xlsx";
echo "new_move_filename is $new_move_filename<br>";
$ret = move_uploaded_file($_FILES["xxxx_file"]["name"], $new_move_filename);
if (! $ret)
{
echo ("ERROR: Unable to move xxxxx upload file to input directory $xxxxx_indir!. Error is '$ret' Check permissions and please try again.");
echo "<p>Debug information<br>";
echo "-----------------<br>";
print_r($_FILES);
exit;
}

 

Can anyone please give me some ideas where to look?

 

Thanks,

 

Steve

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.