max_file_size downloading files using a form

hello guys
i’ve got this code to download files. And the thing is that i do not why i can download any file whether its size is above or below the value given for max_file_size. According to the code I eventually put which is described below, it should not download any file which has size above max_file_size = 0 bytes. Nevertheless, it still downloads files with size >0. So, any idea about, why this value for max_file_size is not being useful in stopping the download of files with size above 0?

Untitled Document <?PHP if ($_POST['send']) { if ($_FILES['downfile'] != "none" AND $_FILES['downfile']['size'] != 0){ echo "Name: ".$_FILES['downfile']['name']."
n"; echo "Size: ".$_FILES['downfile']['size']."
n"; echo "Type: ".$_FILES['downfile']['type']."
n";
	// for Windows
	if (! copy ($_FILES['downfile']['name'], "C:caca\".$_FILES['downfile']['name'])) {
		echo "<h2>File could not be copied</h2>n";
		}
	else
	  echo "great";
	/* for Linux/Unix 
	if (! copy ($_POST['downfile'], "/tmp/".$_POST['file_name'])) {
		echo "<h2>File could not be copied</h2>n";
		}
	} */
	}
elseif (($_FILES['downfile']['name'] != "none") AND ($_FILES['downfile']['name'] == 0)) {
		echo "<h2>File size exceded exceded</h2>n";
		}
else {
		echo "<h2>You haven't choose a new file to download</h2>n";
	}
echo "<HR>n";
}

?>

File to download
Example

I am not sure but I suspect that setting MAX_FILE_SIZE = 0 will “Disable” the option thus allowing ANY file size to be uploaded.

also note:

A better way is to use the upload_max_filesize in the PHP.INI file.

Sponsor our Newsletter | Privacy Policy | Terms of Service