Results 1 to 6 of 6

Thread: Every Size Got A Limit!!!

  1. #1
    Join Date
    Sep 2007
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Every Size Got A Limit!!!

    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!
    Code:
    <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>

  2. #2
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    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...

  3. #3
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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
    Hey new design new look, goto xudas for personal webdsign help.. (:

  6. #6
    Join Date
    Sep 2007
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy unfortunately all my codings is in ASP

    is it possible in asp?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •