Hi All, When we try to upload file through <input type ='file' />, it does not check whether the file really exists on the local file system, even if we give some arbitrary value like 'C:\asdf', it will upload it with 'asdf' as file name with no content. So is there any way to check on the client side with java script (I think we can do it with ActiveX Control but I want to know whether is it possible through JavaScript) whether the file really exists on the client side local system, so that if it is not present I can stop sending the request to the server.
Sorry for posting this thread multiple times... actually when I posted it in 'HTML/DHTML/CSS - JavaScript/VBScript' in the 'forums' section, not in the 'queries and discussions', I could not see my post in the forums immediately, so I just got worried and posted it repeatedly..., then 4th time I posted it in 'queries and discussions'.
Yes! It's possible with JavaScript's FileSystem Object. Here's an example below: Code: var fso = new ActiveXObject("Scripting.FileSystemObject"); fileBool = fso.FileExists("d:\\old.txt");
thanks for the reply pradeep, the code is working, but I have a doubt what is ActiveXObject ? does it comes automatically or embedded with IE, and if this is an ActiveX Object then the code is not pure JavaScript I think?
in firefox.. i even tried with IE. that too gave me this mgs."Automation server can't create object".
You'll need to change the security settings for the zone the page/website is in, goto Tools -> Internet Options, the select Security tab, click on Custom level, location 'Run ActiveX controls and plug-ins' select either 'prompt' or 'enable'.