I have as following but people are uploading profile pictures which is more then 1MB or 2MB and later it becomes very slow login/logout.
How can i limit it to maximum upload 150Kb? and if they upload more then 150Kb or trying to upload more then that size. show a message?
submit:
<form id="uploadForm"
action="<?php echo $fileupload;?>"
method="POST"
enctype="multipart/form-data" target="my_iframe">
<input type="file" name="picture" id="picture" />
<input type="hidden" name="MAX_FILE_SIZE" value="400000" />
<input type="submit" name="submitprofile" id="submitprofile"
/>
</form>
php:
$fdata = 'empty';
if (isset($_FILES['picture']) && $_FILES['picture']['size'] > 0) {
$tmpName = $_FILES['picture']['tmp_name'];
$fp = fopen($tmpName, 'r');
$fdata = fread($fp, filesize($tmpName));
//$fdata = addslashes($fdata);
$fdata = base64_encode($fdata);
fclose($fp);
//$sl = "INSERT INTO image (image)VALUES ( '$data')", $connection);
}