BritSteve Posted March 4, 2018 Share Posted March 4, 2018 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 More sharing options...
mac_gyver Posted March 4, 2018 Share Posted March 4, 2018 if you set php's error_reporting to E_ALL and display_errors to ON (preferably in the php.ini on your development system), php would help you find the exact reason that the move_uploaded_file() statement is failing. Link to comment Share on other sites More sharing options...
BritSteve Posted March 4, 2018 Author Share Posted March 4, 2018 Please delete. I have sorted out the issue. Brain not working properly, it should have been tmp_name and NOT name. Sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.