最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - JavaScript - Save image from URL to local machine specific path? - Stack Overflow

programmeradmin0浏览0评论

Using jQuery/javascript I am making a personal program for me and my friends to use. I wanted to have a functionality that downloads a file from an external (online) url and then save it to a particular directory relative to my /root folder.

I cannot use this on a server as I just want to run the html file locally - however it may be hosted online in the future.

I'm not worried about security at this current point in time - so is this possible to do?

Using jQuery/javascript I am making a personal program for me and my friends to use. I wanted to have a functionality that downloads a file from an external (online) url and then save it to a particular directory relative to my /root folder.

I cannot use this on a server as I just want to run the html file locally - however it may be hosted online in the future.

I'm not worried about security at this current point in time - so is this possible to do?

Share Improve this question asked Apr 2, 2015 at 22:52 ChiMoChiMo 6012 gold badges15 silver badges34 bronze badges 1
  • 1 No. JavaScript cannot save files locally. It doesn't matter if you aren't worried about security--the browser still is. – Dave Commented Apr 2, 2015 at 23:01
Add a ment  | 

1 Answer 1

Reset to default 2

In Javascript you cannot directly save a file to your root folder or choose the location of where the file is saved. However with Javascript you can cause the browser to prompt the user to save the file locally. Take a look at this github project:

https://github./eligrey/FileSaver.js

发布评论

评论列表(0)

  1. 暂无评论