is there a way of checking the size of the file before an upload begins

Discussion in 'HTML' started by Mel, Nov 17, 2004.

  1. Mel

    Mel Guest

    how can i restrict file uploads above certain size ?

    is there a way of checking the size of the file before an upload begins ?

    thanks for help
     
    Mel, Nov 17, 2004
    #1
    1. Advertising

  2. Mel

    brucie Guest

    In alt.html Mel said:

    > how can i restrict file uploads above certain size ?


    yes. the giggly php manual has a good section on file uploading
    http://php.net/features.file-upload

    if php isn't you giggly language just translate what it says into your
    language or check your languages manual.

    excellent forms reference:
    http://www.cs.tut.fi/~jkorpela/forms/index.html

    > is there a way of checking the size of the file before an upload begins?


    yes, see the above. just never forget where it mentions on the form the
    max file size evil people can change it and make you cry.

    > thanks for help


    kissy

    --
    the facts and opinions expressed by brucies
    l i t t l e v o i c e s
    are not necessarily the same as those held by brucie.
     
    brucie, Nov 17, 2004
    #2
    1. Advertising

  3. Mel

    Erich Musick Guest

    Re: is there a way of checking the size of the file before an uploadbegins

    I did a quick google search and found this code. I think it will only
    work on windows, in Internet Explorer

    <html>
    <head>
    <script language="JavaScript">
    function A()
    {
    var oas = new ActiveXObject("Scripting.FileSystemObject");
    var d = document.a.b.value;
    var e = oas.getFile(d);
    var f = e.size;
    alert(f + " bytes");
    }
    </script>
    </head>
    <body>
    <form name="a">
    <input type="file" name="b">
    <input type="button" name="c" value="SIZE" onClick="A();">
    </form>
    </body>
    </html>



    Mel wrote:
    > how can i restrict file uploads above certain size ?
    >
    > is there a way of checking the size of the file before an upload begins ?
    >
    > thanks for help
    >
    >


    --
    In Christ,

    Erich Musick
    http://erichmusick.com

    In the same way, let your light shine before others, so that they may
    see your good works and give glory to your Father who is in heaven. --
    Matthew 5:16 NKJV
     
    Erich Musick, Nov 17, 2004
    #3
  4. Erich Musick enlightened us with:
    > I did a quick google search and found this code. I think it will
    > only work on windows, in Internet Explorer


    In other words: useless.

    Sybren
    --
    The problem with the world is stupidity. Not saying there should be a
    capital punishment for stupidity, but why don't we just take the
    safety labels off of everything and let the problem solve itself?
     
    Sybren Stuvel, Nov 17, 2004
    #4
  5. Mel

    Jan Faerber Guest

    brucie wrote:

    > In alt.html Mel said:
    >
    >> how can i restrict file uploads above certain size ?

    >
    > yes. the giggly php manual has a good section on file uploading
    > http://php.net/features.file-upload
    >
    > if php isn't you giggly language just translate what it says into your
    > language or check your languages manual.
    >
    > excellent forms reference:
    > http://www.cs.tut.fi/~jkorpela/forms/index.html


    There are many links here -

    one gets you there:
    http://www.htmlhelp.com/faq/html/forms.html#file-upload
    .... but no word about restriction here.

    another one:
    http://www.cs.tut.fi/~jkorpela/forms/file.html#restr
    <quote>
    The server-side form handler can be coded to do whatever the programmer
    wants, and imposing some upper limit is clearly a must. (That is, the code
    should check for the input size, and discard, or otherwise process in a
    special way, submissions exceeding a reasonable limit.)
    </quote>
    .... but how?

    And I wouldn't restrict 'restriction' to forms.
    What about ftp upload?




    --
    Jan

    http://html.janfaerber.com
     
    Jan Faerber, Nov 23, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vicky

    Checking file upload size

    Vicky, Feb 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    363
    =?Utf-8?B?QXZuZWVzaA==?=
    Feb 11, 2004
  2. shawn modersohn

    SSL + .htaccess / when encryption begins

    shawn modersohn, Mar 28, 2006, in forum: HTML
    Replies:
    1
    Views:
    405
    Benjamin Niemann
    Mar 28, 2006
  3. Xcott Craver

    2nd Underhanded C Contest Begins

    Xcott Craver, Apr 5, 2006, in forum: C Programming
    Replies:
    13
    Views:
    587
  4. codefest
    Replies:
    0
    Views:
    249
    codefest
    Mar 5, 2010
  5. Al Cholic
    Replies:
    2
    Views:
    107
    Robert Klemme
    Jul 3, 2007
Loading...

Share This Page