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

javascript - Replace file when downloading - Stack Overflow

programmeradmin2浏览0评论

Referring to this example: /

How can I update the content of updatedText.xml when pressing the 'Download' button, just as it does when the 'Save' button in any application?

In this case I just get another updatedText (1).xml, updatedText (2).xml and so on.

Moreover it would be nice if it was possible to specify the directory where the updatedText.xml is saved.

Has someone an idea?

Referring to this example: http://jsfiddle/m9nts8r1/

How can I update the content of updatedText.xml when pressing the 'Download' button, just as it does when the 'Save' button in any application?

In this case I just get another updatedText (1).xml, updatedText (2).xml and so on.

Moreover it would be nice if it was possible to specify the directory where the updatedText.xml is saved.

Has someone an idea?

Share Improve this question asked Oct 28, 2014 at 10:50 wurstbrotrestwurstbrotrest 3291 gold badge7 silver badges17 bronze badges 1
  • Maybe you can try this lib pixelgraphics.us/downloadify/test.html which prompts the user to replace the file if that file already exists – Saurabh Verma Commented Jun 11, 2015 at 10:39
Add a ment  | 

2 Answers 2

Reset to default 5

You cannot do this. Once the file is downloaded it is on your hard drive. Your web browser does not have the permission to access your file system (just imagine what a mess it would be if a website could look into your files or even change them). I guess you will unfortunately have to live with the newly created files or solve your problem with another technology.

You can do it in chrome browser

download extension from this link https://github./zach-adams/downloads-overwrite-already-existing-files "A chrome extension that sets all downloads to overwrite existing files instead of adding ' (1)', ' (2)', etc." then add extension to chrome this will solve your problem.

发布评论

评论列表(0)

  1. 暂无评论