SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot xiaawan's Avatar
    Join Date
    Sep 2007
    Location
    Islamabad, Pakistan
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    checking if file exists

    Hi All,
    I am allowing users to upload a file using following HTML control .
    (<input type="file" value="browse" />).

    There are chances user does not click on browse button but types the file name and its path manually. Can we check through javascript whether that file exists or not?
    Thanks in Advance.
    Zia Awan

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Nope. JavaScript security prevents this. But if they are choosing the file manually the odds are it exists.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When they try to upload the file and it fails (because the file doesn't exist) you may be able to detect that.

  4. #4
    Non-Member
    Join Date
    Aug 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When they try to upload the file and it fails (because the file doesn't exist) you may be able to detect that.
    => how to do this with javascript?

  5. #5
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    You can't. It will have to be done on the server side. Usually a file size of zero indicates failure. Depending on what language you use it may even have functions to do this for you.


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
  •