File exists in javascript
-
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.
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.
-
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.
-
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; }