html - OpenSave file in javascript - Stack Overflow

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

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.

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.

Share Improve this question asked Jul 25, 2010 at 8:26 CheeryCheery 25.5k16 gold badges61 silver badges83 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

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

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

Currently there is no way to save the file

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 remend 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"...

For security you cannot do it with Javascript alone. The usual ways to access the filesystem from JavaScript require the help of something else:

  • Java applets are available on just about all browsers.
  • ActiveX is an option on Internet Explorer.
  • On Firefox you can use an extension.
  • Flash also allows certain kinds of access.

These probably all require some arcane techniques, can be disabled by the user, and may need parts to be specifically installed or OK'd by the user.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745591485a4634858.html

相关推荐

  • html - OpenSave file in javascript - Stack Overflow

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

    10小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信