Jump to content

post_max_size expanded from 8M to 100M, but I can not upload larger than cca2M?


pioneerx01

Recommended Posts

Hi, I created the code below for uploading anywhere from 1-15 PDF files at once. Originally I was hitting 8M limit and (as per my research) I asked my server admin to expand the post_max_size to 100M. Now he did and I verified it, but somehow now I can not upload more than cca 2MB files. What could be causing that? Thanks

 

	$forms = array("form_1", "form_1A", "form_1B", "research_plan", "abstract", "form_1C", "form_2", "form_3", "form_4", "human_consent", "form_5A", "form_5B", "form_6A", "form_6B", "form_7");
	foreach ($forms as $form_name) 
		{
		if ($_FILES[$form_name]['name'] != "") 
			{
			$allowed_filetypes = array('.pdf','.PDF'); 
			$max_filesize = 104857600; 
			$upload_path = 'upload/'; 
			$extension = substr($_FILES[$form_name]['name'], strpos($_FILES[$form_name]['name'],'.'), strlen($_FILES[$form_name]['name'])-1);
			$filesize = filesize($_FILES[$form_name]['tmp_name']);
			$filesize_MB = $filesize / 1048576;
			$full_name = $_FILES[$form_name]['name'];
			$filename = "$_REQUEST[project_no] - $form_name$extension";

			if (!in_array($extension,$allowed_filetypes)) {$error_1 = "yes";}
			if (filesize($_FILES[$form_name]['tmp_name']) > $max_filesize) {$error_2 = "yes";}

			if ($error_1 == "yes")
				{
				echo "One or more of the uploaded froms are not in allowed file format. Please upload only <strong>.pdf</strong> files
				<br/><br/><INPUT TYPE='button' VALUE='Go Back' onClick='history.go(-1);'>";
				die ();
				}

			if ($error_2 == "yes")
				{
				echo "Maximum upload file size of <strong>100MB</strong> has been reached. 
				<br/><br/><INPUT TYPE='button' VALUE='Go Back' onClick='history.go(-1);'>";
				die ();
				}
			move_uploaded_file($_FILES[$form_name]['tmp_name'],$upload_path . $filename);
			mysql_query("UPDATE project_registrations SET $form_name = 'yes' WHERE project_no = '$_REQUEST[project_no]'");
			}
		}
	echo "ISEF files for project number <strong>$_REQUEST[project_no]</strong> have been successfully uploaded.";
	mysql_query("UPDATE project_registrations SET isef_forms = 'yes' WHERE project_no = '$_REQUEST[project_no]'");
	require ("upload_forms_email.php");
	echo "<script language='javascript'> window.location.href='search_results.php?project_no=$_REQUEST[project_no]';</script>";

Oh I see. I have:

 

upload_max_filesize = 2M

max_file_uploads = 20

 

So I guess I should have upload_max_filesize increased to 100M as well? Anything else I should look into while I am emailing my admin?

 

Thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.