Save Image with Custom Name

I have the following image tag on the page:

<img src="http://photo.com/img/p806792255-6.jpg" id="will6-1" alt="will6-1" title="will6-1" />

When the user runs “Save Image As,” the default name is p806792255-6.jpg .

How to make the default name appear as something else, for example, will6-1.jpg ?

+3
source share
3 answers

What you need to do, you can decide using the placement of content .

, , , / . , . Google , .

:

Response.AddHeader "content-disposition","attachment; filename=fname.ext"

, :

MS KB # 260519 URL: http://support.microsoft.com/kb/260519

+2

download

<a download="filename.ext" href="http://website.com/file.ext">download this file</a>
+3

Without the physical designation of the image that you would like to see, I do not see how you can call a person what they should call their image. Perhaps use the server side of the script to render the image, then pass the "suggested name" in the tag Content-Disposition. Even then, he will probably try to use the name of the render page (getimage.php / asp / etc) and add the MIME type for the extension).

0
source

Source: https://habr.com/ru/post/1779670/


All Articles