shalmoli Posted January 30, 2009 Share Posted January 30, 2009 In php.ini - - tmp_dir is set - open_basedir includes tmp_dir path Still I get file upload error 6. I guess there is some issue in the php.ini config. I guess there are just 2 directives that interfere with file uploads - tmp_dir and open_base_dir. Max size is 2M , so I guess there are no issues regarding file size as I am just trying to upload a testfile of 1KB. I get the error right at $_FILES. Array ( [userfile] => Array ( [name] => test.txt [type] => [tmp_name] => [error] => 6 => 0 ) ) I am posting the code and this code works in one server but not the other. _________________________________________________________________________ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Upload Test</title> </head> <body> <form enctype="multipart/form-data" action="upldtest.php" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="99999999" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> </body> </html> <?php $form_data = $_FILES['userfile']['tmp_name']; print_r($_FILES); //set the location $base_name = $_SERVER['DOCUMENT_ROOT']."/uploads/".$form_data; //move_uploaded_file($form_data, $base_name); // upload the file to the server if(copy($_FILES['userfile']['tmp_name'], $base_name)){ echo "upload successful"; } else{ echo "Upload Failed"; } ?> Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/143119-solved-file-upload-error-tmp_dir-not-found/ Share on other sites More sharing options...
printf Posted January 30, 2009 Share Posted January 30, 2009 what is temporary directory set to? It has to be path problem. Quote Link to comment https://forums.phpfreaks.com/topic/143119-solved-file-upload-error-tmp_dir-not-found/#findComment-750595 Share on other sites More sharing options...
shalmoli Posted January 30, 2009 Author Share Posted January 30, 2009 Thanks for the reply. I am copying the value of both the directives from phpinfo() open_basedir /var/www/tor/projects/:/tmp/:/var/tmp/:/var/www/tor/tmp/:/var/lib/php5:/usr/share/php/ no value upload_tmp_dir /var/www/tor/tmp/ no value Do you think there are any other field in php.ini that influences the value? Quote Link to comment https://forums.phpfreaks.com/topic/143119-solved-file-upload-error-tmp_dir-not-found/#findComment-750600 Share on other sites More sharing options...
printf Posted January 30, 2009 Share Posted January 30, 2009 Remove the trailing forward slash from your temporary upload directory. Your open_basedir directive allows access to /var/www/tor/tmp/, so the temporary upload directory must be set to it's root, not to the directory it's self. upload_tmp_dir /var/www/tor/tmp Quote Link to comment https://forums.phpfreaks.com/topic/143119-solved-file-upload-error-tmp_dir-not-found/#findComment-750615 Share on other sites More sharing options...
shalmoli Posted January 30, 2009 Author Share Posted January 30, 2009 Thanks a lot :-) The issue was indeed the trailing slash in upload_tmp_dir. The issue is resolved now. Quote Link to comment https://forums.phpfreaks.com/topic/143119-solved-file-upload-error-tmp_dir-not-found/#findComment-750621 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.