Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi,

I want to read and write text file on client's PC from where 3rd party desktop application can able to read that file.

Please guide me on how to read/write text file to the client's PC using jquery or javascript.

Chrome browser will be used in Window or Mac OS.

Thanks.
Posted

You can't.

Your website has no access to reading or writing files on your client computer for security reasons. Think about it: if you could do it, so could malicious sites...
 
Share this answer
 
Comments
Dusara Maulik 18-Aug-15 7:38am    
Hi OriginalGriff,

I know this. Is there any other option from where we can achieve this? Actually I want to generate UPS shipping XML files for UPS Worldship which will automaticall read the file and generate shipment.

Please guide me how to achieve this.
Thank You.
Dave Kreskowiak 18-Aug-15 7:48am    
The only way you can pull off anything like this is if the client uploads the file to your server and the server side code does it's processing on that uploaded file.

Your server code can NEVER get access to the files on a client.
OriginalGriff 18-Aug-15 7:54am    
You would have to be running a separate application on the client computer, which "talks" to your server. You cannot do this from within the browser, or from your server.

And the chances of you getting that loaded on most people's computers is very, very low! :laugh:
If you are wanting to read the file without some form of user interaction, you are out of luck. JavaScript always runs in the "sandbox" of the browser and does not have access to any resources outside of the sandbox. This is done for security reasons.

However if your users are selecting files for processing you could look at the File API for JS that most modern browsers support. https://developer.mozilla.org/en-US/docs/Web/API/File[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900