eatadi Posted September 8, 2009 Share Posted September 8, 2009 I am using this simple peice of code below to upload a file from an html form. The issue is that it works fine on a godaddy linux server, but I get there was an error uploading the file message when trying the same code on a Verio unix server. It's driving me NUTS! Any ideas? I looked over permissions a trillion times, is there anything I have to set in the php.ini file or any error handling i can add to get specific issue? $target_path = "modelresumes/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } thanks. Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2009 Share Posted September 8, 2009 Could be one of several possible problems. What do you get when you add the following code immediately after your first opening <?php tag - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/#findComment-914992 Share on other sites More sharing options...
eatadi Posted September 8, 2009 Author Share Posted September 8, 2009 Hi, I get the following message. POST:Array ( [MAX_FILE_SIZE] => 100000 ) FILES:Array ( [uploadedfile] => Array ( [name] => FINAL-SEAN-KINGSTON-INVITE.jpg [type] => [tmp_name] => [error] => 6 => 0 ) ) There was an error uploading the file, please try again! Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/#findComment-915008 Share on other sites More sharing options...
eatadi Posted September 8, 2009 Author Share Posted September 8, 2009 From what I read, error 6 means that the server is missing a temporary folder. I checked the server and on the root, tmp is on the server and I changed the permissions, but I still get the same error. Is there something in the php.ini file I need to change? Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/#findComment-915044 Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2009 Share Posted September 8, 2009 Check what a phpinfo(); statement shows for the upload_tmp_dir setting. It is probably set to some specific folder that does not exist. Either change it to point to a folder that does exist or create a folder that matches what it is set to. Stop and start your web server to get any change made to php.ini to take effect and use a phpinfo() statement to confirm that the setting was actually changed. upload_tmp_dir string The temporary directory used for storing files when doing file upload. Must be writable by whatever user PHP is running as. If not specified PHP will use the system's default. Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/#findComment-915062 Share on other sites More sharing options...
eatadi Posted September 9, 2009 Author Share Posted September 9, 2009 Yup tmp directory was the issue, had to call hosting company to apply ini changes. Thanks alot! Link to comment https://forums.phpfreaks.com/topic/173589-solved-move_uploaded_file-server-issues/#findComment-915480 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.