Jump to content

CAN'T SET MAX_file_SIZE


vurentjie

Recommended Posts

hi i am trying to set a max file size for uploading an image, the upload and deleting functions work fine, except for the fact that when i put my stuff online the max_file_size is ignored, but when i work offline it seem to work fine, i have chopped and changed the code to get it to work but to no avail,

 

i first started off defining a constant define('max',51200);

 

then i just set a $var = 51200;

 

either way seems to work offline

 

if (array_key_exists('upload', $_POST)) 
{

	$l_pc_upresult = "SELECT DISTINCT * FROM ..........";
	$l_pc_upquery = @mysql_query($l_pc_upresult);

	while($pc=mysql_fetch_array($l_pc_upquery))
	{

		// define constant for upload folder
		define('UPLOAD_DIR', '../picfolder/');	

		$l_pc_save = $pc['........']."_".$a_real_add_pc.".jpg";


		if ($_FILES['image']['size'] <= MAX_FILE_SIZE)
		{

			// move the file to the upload folder and rename it
			move_uploaded_file($_FILES['image']['tmp_name'], UPLOAD_DIR.$l_pc_save);
			$NO = "";
			}
			elseif($_FILES['image']['size'] > MAX_FILE_SIZE)
			{
			$NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>";
			}
			elseif($_FILES['image']['size'] < 0)
			{
			$NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>";
			}
			else
			{
			$NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>";
			}




	}	

}

 

i have tried many variations of this even a switch statement that checks the $_FILES['image']['error'];

 

but as i said it works offline, but online even if the max is reached the file still writes to the folder

 

is their something i am missing?

 

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.