SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Checking the size of a file!

    Hi all

    I would like to tell me the way that i can check the file size which is gonna be uploaded via a form.

    Are there relative tutorials?

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the file size before the form is submitted?
    Can't be done...

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, i use php. So there are bugs when i am cheching the files.

    If you have a form with too many fields and an upload input as well, then if you submit them and accidentally someone submit a big file the an error occurs by the system.I suppose you know script languages server side and especially php so when the error happens the all the data in the fields that the users had previously submitted is gonna to be lost, Am i right?

    I want to predict this and in the worst case i want the user to be able to go to the from with the data in the fields.

    How could i make it?

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have to correct myself; you can add a hidden form field called MAX_FILE_SIZE
    The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent this maximum. So don't count on it that the browser obeys your wish! The PHP-settings for maximum-size, however, cannot be fooled.
    http://www.php.net/manual/en/feature...ad.post-method

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried that, but id somene uploads a file bigger than 2 Mb then an error from the php core occurs (php.ini) i am not allowed to touch the php.ini

    So i want to predict the worst case and the user doesn't loose his data( think the case that there is a TEXTAREA and the user has written a huge text, like forums.)

    Then what i have to do?

  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the length of the textarea value before the form is submitted? Can be done with javascript

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You mean to store the value of the text?

    Do you know any relevant tutorial?


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
  •