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>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.