barrylee Posted September 16, 2008 Share Posted September 16, 2008 Hi, can anyone advise, I have wriiten a script for users to upload mp3 files to the site directory, it works fine on files less than 5-6 mb but not on files larger than that. I have created a cutom ini file as below; print ini_set("max_execution_time", "0") . "<br />"; print ini_set("max_file_upload", "20mb") . "<br />"; print ini_set("max_post_size", "20mb"); It appears to copy up files over 10 mb but then bombs out at the last second and gives me the custom error message. I am using the following for my file upload; if(move_uploaded_file($_FILES ........ etc Pleeeeeese help! Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/ Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 Sorry this is in html stuff, but it's basically the error codes: <tr valign='top'><td>UPLOAD_ERR_OK</td><td><b>Value: 0;</b> There is no error, the file uploaded with success.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_INI_SIZE</td><td><b>Value: 1;</b> The uploaded file exceeds the upload_max_filesize directive in php.ini.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_FORM_SIZE</td><td><b>Value: 2;</b> The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_PARTIAL</td><td><b>Value: 3;</b> The uploaded file was only partially uploaded.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_NO_FILE</td><td><b>Value: 4;</b> No file was uploaded.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_NO_TMP_DIR</td><td><b>Value: 6;</b> Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_CANT_WRITE</td><td><b>Value: 7;</b> Failed to write file to disk. Introduced in PHP 5.1.0.</td></tr>\n <tr valign='top'><td>UPLOAD_ERR_EXTENSION</td><td><b>Value: 8;</b> File upload stopped by extension. Introduced in PHP 5.2.0.</td></tr>\n Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643111 Share on other sites More sharing options...
barrylee Posted September 16, 2008 Author Share Posted September 16, 2008 nice one, that should shed some light on it, I'll give it a go! Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643117 Share on other sites More sharing options...
barrylee Posted September 16, 2008 Author Share Posted September 16, 2008 so would an example of using that be if(not uploaded etc){ if(UPLOAD_ERR_INI_SIZE) { echo "The uploaded file exceeds the upload_max_filesize directive in php.ini." } } Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643124 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 I don't seem to be able to find the official documentation, but here's an example. Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643129 Share on other sites More sharing options...
barrylee Posted September 16, 2008 Author Share Posted September 16, 2008 awesome example, thanks, I am sure the mystery will be unravelled now Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643140 Share on other sites More sharing options...
barrylee Posted September 16, 2008 Author Share Posted September 16, 2008 Actually that didn't work, I got the default message in the switch statement "There was a problem with your upload" It did not return the $HTTP_POST_FILES['userfile']['error'] number. I am still none the wiser ??? Link to comment https://forums.phpfreaks.com/topic/124532-large-file-uploads/#findComment-643152 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.