Log in

View Full Version : Every Size Got A Limit!!!



hantz
09-27-2007, 11:18 PM
i can't find any script that limist all kind of files before uploading...
i mean if you choosing a file to upload and it is more than the size you was gicen the javascript tells you that you can't choose this file and resets the field...
i found that one! and it's realy good but only for images...when you try to upload a regular file it will let you...
come on people there is got to be a way(not activeX) to check size of files like txt and doc!
<form name="formData">
<input type="file" name="uploadfile" onchange="setdumy(value)">
</form>
<img style="visibility:hidden;position:absolute;" id=dumy onload="checksize()">
<script language="javascript">
function setdumy(file)
{
dumy.src=file;
}
function checksize()
{
if (dumy.fileSize>51200)
{
formData.reset();
alert("fileSize should be less than 50K!");
}
}
</script>:confused:

Rockonmetal
09-28-2007, 12:15 AM
I don't see anything that says check image... can you give the stuff in the head of the page for this script *take out user information and safety stuff or just change em to:
user 1
safe!
Hope this helps... I will need to see the rest of it before I can say unsolvable...

Trinithis
09-28-2007, 05:07 AM
http://www.dynamicdrive.com/forums/showthread.php?t=21964

djr33
09-28-2007, 05:17 AM
The way that you can disable files larger than a certain value is:
1. Post a note-- "must be under 2mb".
2. Use the MAX FILE SIZE hidden value (if using PHP) in the form.
3. Detect size and reject if it's too big server side.

You can't really detect the size of data being sent, you just have to react after.

http://www.php.net/manual/en/features.file-upload.php

insanemonkey
09-28-2007, 05:18 AM
im sorry but you are going to have to revert to php...

check here. for a sample php script!

http://dynamicdrive.com/forums/showthread.php?t=25143

hantz
09-28-2007, 11:49 AM
is it possible in asp?