SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    UK
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is file upload size validation possible

    Hello everyone.

    Is it possible to check for file upload size using Javascript?

    I know how to do it using PHP, but I'd like to use Javascript as an additional validation process to ease on server load.

    Any help/pointers would be greatly appreciated.

    Thanks
    Matt

  2. #2
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Can't be done with javascript. Security features built in to the language stops any file read or writing on a client's machine. When you click the browse button in an html file input, it only grabs the path string to the file in question. Anything you wish to do after that can only be accomplished with a server-side solution.

    -xDev

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    UK
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok .. thanks for your reply

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xDev, not 100% true, as ActiveX allows for file reading/writing, but it's a security issue and should not be done. It's also IE/Win only.

    So, from a theory standpoint, it's possible, but from an application standpoint, I agree with you -- it should not be considered.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    xDev, not 100% true, as ActiveX allows for file reading/writing, but it's a security issue and should not be done. It's also IE/Win only.

    So, from a theory standpoint, it's possible, but from an application standpoint, I agree with you -- it should not be considered.
    Beetle,

    Your right as usual

    I was thinking the same thing when I posted but decided not to even point it out. And as you mentioned, ActiveX (and JScript) aren't very practical for this situation.

    -xDev


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
  •