views:

52

answers:

2

I'll write an app that'd need to let user load PNG&JSON files and then save them.

How could I let user open and save such files? I wouldn't like to write up an echo server for those images.

+1  A: 

I'll pull Facebook into the conversation. Facebook uses Java to do such a thing.

I should note that you can NOT access the user's hard drive directly in JavaScript. This includes read, write, copy, flag, whatever. It would be a nice security concern, even though most of us who have wanted to do this [including me two years ago] have good intent.

Now, some browsers (cough IE) do allow you to access the user's filesystem through ActiveX, after they click "allow activex"... but that isn't cross-browser/cross-platform, so I wouldn't recommend it. Check: Scripting.FileSystemObject, fopen


You can, however, have the user upload a file to your server, temporarily, load that file client-side, do whatever you want, save the file to the server, and load the image to the user with the mime-header "content" of "application/force-download"...

ItzWarty
Yeh. I could upload the file but it's just boring to maintain a such echo server.
Cheery
An echo server is required atm, though. It's unfortunate, and yes, it's a pain. I assure you that if there was a better cross-platform/browser method, people would jump onto it immediately...
ItzWarty
+1  A: 

You can load files with File API (only supported in firefox 3.6 and chrome unstable (maybe beta) at the moment):

http://dev.w3.org/2006/webapi/FileAPI/

Currently there is no way to save the file

arjan