0

I want to save image on click, in a name that i want

I tried the solution suggested in a SO post

 <a href="http://farm3.staticflickr.com/2881/10000610654_fdf29eb02f_q.jpg" download="myPreferredName.jpg">
    <img src="http://farm3.staticflickr.com/2881/10000610654_fdf29eb02f_q.jpg" alt="Smiley face">
</a>

The problem that i am facing is, when i click on the image its downloading in the name "10000610654_fdf29eb02f_q.jpg" instead of "myPreferredName.jpg"

Demo Fiddle

I am ok to use javascript,jquery or any other scripting

Community
  • 1
  • 1
Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150
  • Related: http://stackoverflow.com/questions/23872902/chrome-download-attribute-not-working – blex Aug 13 '15 at 12:32
  • 1
    in firefox and IE its navigating to that image path :( not even downloading – Vignesh Subramanian Aug 13 '15 at 12:45
  • Is the HTTP header Content-Disposition set? See the download attribute at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a – j08691 Aug 13 '15 at 13:08
  • IE does not use the `download` attribute ([CanIUse](http://caniuse.com/#feat=download)), so that's normal. But Firefox should if you set the right headers. – blex Aug 13 '15 at 13:09
  • looks like it is not possible to overwrite the headers with preferred name in the download attribute – Vignesh Subramanian Aug 13 '15 at 13:48

0 Answers0