开发者

How to give file name at base 64 images

I have following code which use image of base64, when i right click on ti and save it, it tried to save as download.gif. how can i give the name of file to download instead of having name as download.gif?

<img src="data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub/
/ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcpp
V0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7" 
width="16" height="14" alt="embedded folder icon">

thank you in开发者_开发知识库 advance.


You can use link wrap with download attribute.

<a href="data:image/gif;base64,R0l...QA7" download="some_name.gif">
    <img src="data:image/gif;base64,R0l...QA7" width="16" height="14" alt="embedded folder icon"/>
</a>

Right click - save object as - this get you name in most modern browsers.


You cannot. The data URI spec does not allow for specification of a file name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜