Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. File exists in javascript

File exists in javascript

Scheduled Pinned Locked Moved Web Development
javascript
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larza123
    wrote on last edited by
    #1

    I'm not sure that this is possible. I want to check if a file exists on the clients computer. They are uploading files on my site and I want to give them an errormessage if the file doesn't exist before postback.

    R 1 Reply Last reply
    0
    • L Larza123

      I'm not sure that this is possible. I want to check if a file exists on the clients computer. They are uploading files on my site and I want to give them an errormessage if the file doesn't exist before postback.

      R Offline
      R Offline
      Raman Pal Singh
      wrote on last edited by
      #2

      You can use following code **function DoesFileExist(sFileName) { var objFSO = new ActiveXObject("Scripting.FileSystemObject"); return objFSO.FileExists(sFileName); }** Before page is submitted call this function and if it returns true then only submit the page.

      Larza123 wrote:

      Before page is submitted call this function and if it returns true then only submit the page.

      L 1 Reply Last reply
      0
      • R Raman Pal Singh

        You can use following code **function DoesFileExist(sFileName) { var objFSO = new ActiveXObject("Scripting.FileSystemObject"); return objFSO.FileExists(sFileName); }** Before page is submitted call this function and if it returns true then only submit the page.

        Larza123 wrote:

        Before page is submitted call this function and if it returns true then only submit the page.

        L Offline
        L Offline
        Larza123
        wrote on last edited by
        #3

        Thanx for the answer but I don't want to use an AcitveX control on the page.

        G 1 Reply Last reply
        0
        • L Larza123

          Thanx for the answer but I don't want to use an AcitveX control on the page.

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          It's not an ActiveX control, it's just an ActiceX object. However, that method doesn't work at all. There is no way that you can get any information at all about the client file system using Javascript. The only way to get access to that information would be to use a component on the page, like an ActiveX control or a Java applet. --- b { font-weight: normal; }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups