mohammed.yahya Posted September 2, 2009 Share Posted September 2, 2009 Hi All, I have a code that upload MS excel file. I tried it in two envirunment. 1-PHP 5 2- PHP 4 It worked with the first envirunment. But, it does not upload with the second one. Below is the code: Form Code: <form name="exc_upload" method="post" action="upload_file.php" enctype="multipart/form-data"> <tr><td><strong>تحميل الملف:</strong></td><td><input type="file" size=30 name="excel_file"></td></tr> <tr><td></td><td></td></tr> <tr><td colspan="2" height="49" align="left"> <input type="hidden" name="step" value="1"> <input type="hidden" name="rmB" value="$rmB"> <input type="hidden" name="projectId" value="$projectId"> <input type="button" value="التالي" onClick=" javascript: if( (document.exc_upload.excel_file.value.length==0)) { alert('You must specify filename first'); return; }; submit(); "></td></tr> </form> Action code: $excel_file = $_FILES["excel_file"]; if( $excel_file ) $excel_file = $_FILES["excel_file"]["tmp_name"]; if(empty($excel_file)) fatal("No file uploaded"); The output that I got in the second envirunment is :No file uploaded I checked that the file uploads in php.ini is On and the maximum size is withing the range. What could be the problem? please, help me. thanks Link to comment https://forums.phpfreaks.com/topic/172799-solved-upload-work-in-one-envirunment-and-does-not-in-other/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 2, 2009 Share Posted September 2, 2009 Use the following code to see exactly what is in the $_FILES and $_POST array - echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/172799-solved-upload-work-in-one-envirunment-and-does-not-in-other/#findComment-910767 Share on other sites More sharing options...
mohammed.yahya Posted September 2, 2009 Author Share Posted September 2, 2009 After adding the code you gave me. This is the output: POST:Array ( [step] => 1 [rmB] => 1 [projectId] => 455 ) FILES:Array ( [excel_file] => Array ( [name] => test.xls [type] => application/vnd.ms-excel [tmp_name] => /tmp/phpy2kaOM [error] => 0 => 17920 ) ) Thanks for your help. Now, is the problem clear? Link to comment https://forums.phpfreaks.com/topic/172799-solved-upload-work-in-one-envirunment-and-does-not-in-other/#findComment-910778 Share on other sites More sharing options...
mohammed.yahya Posted September 2, 2009 Author Share Posted September 2, 2009 Using :error_reporting(E_ALL); The output is: Warning: move_uploaded_file(upload/test.xls): failed to open stream: Permission denied in /var/www/html/master/RMS/upload_file.php on line 214 Warning: move_uploaded_file(): Unable to move '/tmp/phpBdOb9N' to 'upload/test.xls' in /var/www/html/master/RMS/upload_file.php on line 214 Link to comment https://forums.phpfreaks.com/topic/172799-solved-upload-work-in-one-envirunment-and-does-not-in-other/#findComment-910785 Share on other sites More sharing options...
mohammed.yahya Posted September 2, 2009 Author Share Posted September 2, 2009 I figured out the problem. It is solved now. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/172799-solved-upload-work-in-one-envirunment-and-does-not-in-other/#findComment-910803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.