3

I want to download file from external server but after renaming it. Let's say http://playtictactoe.atwebpages.com/logo.png is an image file I want to download. I have used the following HTML:

<a href="http://playtictactoe.atwebpages.com/logo.png" download="myName.png">
    Download File
</a>

But this doesn't rename the file. I've read somewhere that this is because of Response Header on server. Is there any way to ignore Response Header on client side? Else guide me any other solution.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124

1 Answers1

1

You can download the file as a buffer and resave with the file api like descriped here:

HTML5 File API downloading file from server and saving it in sandbox

Or lookup FileAPI and XMLRequest to Buffer. You download the file as binaryBuffer save it with fileAPI and rename it. This should also work in Firefox. But this is not the simple solution you are searching for. Even though it works ;-)

You can then rename the file like you want.

Cheers

Community
  • 1
  • 1
Kilian Hertel
  • 166
  • 1
  • 14