PDA

View Full Version : Saving and Reading Files


Matt_Mikolaj
08-29-2006, 02:29 PM
Hello!

I was wondering if there was any way with JavaScript, VBScript, or any other language to save and read a file on someone's computer. The file that reads and writes will be on the user's computer, and not on a server. Any language will do, really, but it has to be a programming language that works in other browsers besides Internet Explorer.

Thanks!
Matt

blackpepper
08-29-2006, 07:02 PM
what are your intentions?, are they malicious?

Matt_Mikolaj
08-30-2006, 10:47 AM
No, not at all. It's just I want a way to save a text file to the user's computer depending on what they enter in a text box.

blackpepper
08-30-2006, 12:20 PM
How about setting a cookie with the data?

Matt_Mikolaj
08-30-2006, 10:26 PM
Yes, I could do that. But then it all would be deleted after the user clears the cookies. I think I'll just create a C++ program that makes the file. Thanks!

corey84
08-30-2006, 11:09 PM
Why not take the data create a txt file and ask them to download it? A C++ program will still not be allowed to put files on a users computer.. The browser stops it.

blackpepper
08-30-2006, 11:15 PM
he probley meant AFTER you install his program, which actually makes me think hes up to no good. Also is it me or doesnt javascript have the ability to write a file to the clients pc? txt file atleast? i swear iv seen something but maybe im getting mixed up.

RysChwith
08-31-2006, 08:37 AM
JavaScript can't write files, no; just cookies. JavaScript can send variables to a server-side script, which can then write files on the server (assuming proper permissions), but that's about it.

Rys

blackpepper
08-31-2006, 11:21 AM
eh,, with activex in ie you can create a textfile.

RysChwith
08-31-2006, 01:15 PM
You're right; I overlooked that option. I tend to stay away from anything that only works in IE, though.

Rys

Matt_Mikolaj
08-31-2006, 05:40 PM
Yeah, I don't like IE very much. That's why I use Firefox.

Trust me, I'm not trying to do anything malicious. I just want to create a page on the user's computer, with data that they enter, that is saved when they are done. Like I said before, I'll probably just make a C++ program that edits certain places on the page.

erisco
08-31-2006, 06:20 PM
Regardless you will probably be best to compress the results in a .zip, and provide a dynamic link to download it. Then you can delete the file afterwards.

blackpepper
08-31-2006, 06:22 PM
why not writing the file to your own server?? as long as you dont allow to create server side scripts (only logging to txt files/htm/ect) you can do it from inside the browser and then provide a download link to grab the finished product.