calum.mackenzie Posted June 11, 2008 Share Posted June 11, 2008 Hey, got a problem with a simple upload script. I want to upload files in many formats up to the size of 25Mb. I have altered both php.ini files on my system to have upload_max_filesize = 25M max_execution_time = 600 memory_limit = 128M max_input_time = 600 post_max_size = 25M and added an .htaccess in the hope to get something larger than 2Mb through php_value post_max_size 25M php_value upload_max_filesize 25M running phpinfo() reflects these changes I have tried my code out on my two ubuntu rigs and both return an error 1 message, which means the uploaded file has exceeded the limit. so more likely to be a code error, heres my upload.php file, this returns error code 1 when larger than 2Mb if(isset($_POST['submit'])){ if (is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])){ //init variables default values echo $_FILES['file']['tmp_name']; $type ="unknown"; $tags = ""; $type = "bin"; $author = ""; $time = time(); $description = $_POST['decrp']; $author = $_POST['author']; $tags = strtolower($_POST['tags']); //get details from POST_FILES $org_title = $HTTP_POST_FILES['file']['name']; $size = $HTTP_POST_FILES['file']['size']; $mime_full = $HTTP_POST_FILES['file']['type']; //get clean title $tmp_title = explode('.',$org_title); $title = $tmp_title[0]; $title = trim($title); $title = str_replace(" ", "_", "$title"); //get type and ext $mime = explode('/',$mime_full); $ext = end($mime); $type = $mime[0]; echo "mime is ". $mime; echo "mime 0 ". $mime[0]; echo "mime 1 ". $mime[1]; echo "mime 2 ". $mime[2]; //fix silly ms problems if ($ext == "msword"){$ext = "doc";} if ($ext == "vnd.ms-powerpoint"){$ext = "ppt";} if ($ext == "vnd.ms-excel"){$ext = "xls";} $new_location = "../files/".$type."/"; makeDirectory($new_location); $new_location = $new_location.$time.".".$ext; //move physical file copy ($_FILES['file']['tmp_name'], $new_location) or die ("1ERROR: ".$HTTP_POST_FILES['file']['error']); //add to database $file_id = add_to_db($author, $title, $type, $ext, $size, $new_location, $description, $tags, $time); echo "<p>Upload of ".$title ." successful</p>"; echo "<p><a href=\"../doc_upload.php\">add another file</a></p>"; }else{ echo "2ERROR: ".$HTTP_POST_FILES['file']['error']; } } Any ideas? Cheers Link to comment https://forums.phpfreaks.com/topic/109724-max-post-upload-size/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 11, 2008 Share Posted June 11, 2008 Could you post the actual phpinfo() output for those settings, showing both the master and local values. Are the settings you posted exactly as you have entered them? For example, if you actually have MB or Mb, this is a syntax error and won't work. Php has been known to display setting values but not actually use them when there are conflicts or syntax errors in the values. If you have access to the master php.ini (and have verified it is the one php is using), make your changes in it only (stop and start your web server to get any changes made to php.ini to take effect.) You should only have one master php.ini. If php is running as a CGI wrapper, then you can have a local php.ini in your document root folder. Php settings are only permitted in a .htaccess file when php is running as a server module and there is an AllowOverride setting that permits it. Link to comment https://forums.phpfreaks.com/topic/109724-max-post-upload-size/#findComment-563225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.