Feb 18, 2011
What I'm trying to do is have a 'Save As' dialog box pop up when I click an anchor tag.What's hidden in the anchor tag is base64 information, so my anchors look like this:
View 1 Replies
<a href=# src='data:application/octet-stream;base64, (base64 string)'>file name</a>
So when I click on this, it gives me the option of downloading my base64 info just fine, but the problem is, the name of it looks to be just the entire base64 string. I was wondering if there was a way I could set this name? I can get the file name, so I'd love to just put 'blah.jpg' as the name that the user downloads.The reason I'm asking is because when I download the file, it comes out as (random characters).bin.part, and if I know the download is a pdf, I try opening it with a pdf viewer, but get yelled at by the MIME type... however, if I simply change '.bin.part' to '.pdf', I can open the file just fine, so I'd love for an automatic naming system, but not sure how to implement that.I've tried the document.execCommand('saveAs', '1', '<filename here>'), but I think this is for an actual file that you serve from the server... I don't have the actual file, just the base64.