Hi ive made a PHP file upload page and im now trying to a put a max file size limit to it
im trying to use:
[code=php]
$filesize = $HTTP_POST_FILES[‘userfile’][‘size’];
$maxfilesize = ‘25000000’;
if ($filesize > $maxfilesize){
header (“Refresh: 3; URL=../fileinfo/selectfile.php”);
?>
<h2 align=”center”>File Size is larger than the limit</h2>
<?php
exit();
}
else if ($filesize < $maxfilesize){
but this doesnt seem to do anything as i get the following errors
Warning: fread(): supplied argument is not a valid stream resource in setupuploadfile.php on line 54
Warning: fclose(): supplied argument is not a valid stream resource in setupuploadfile.php on line 56
from this code which is in the following else if statement
[code=php]
$fp = fopen($tmpName, ‘r’);
$filedata = fread($fp, $filesize);
$filedata = addslashes($filedata);
fclose($fp);
any ideas?
thanks for any help