Application Octet Stream Filename
File Extensions Associated with application/octet-stream MIME: PKG file extension (3D Image Files). Automise ActionStudio Action Design (VSoft Technologies Pty Ltd.).
I am trying to download a file using data uri in following manner:
The problem is that the downloaded file is always named 'Unknown', whatever I try to use as filename. Is this the correct way to give the file a name ? or something else needs to bedone ?
5 Answers
Here's the solution, you just have to add a download
attribute to anchor taga
with desired name
Another solution is to use JQuery/Javascript
On Safari, you might want to use this, and instruct the user to ⌘-S the file:
Otherwise, this uses Filesaver.js, but works ok:
The spongebob squarepants movie online. The SpongeBob SquarePants Movie online for Free. The SpongeBob SquarePants Movie full episode in High Quality/HD.
Note: There is some AngularJS in the code above, but it should be easy to factor out..
For those that are using other libraries like angularjs or backbone, you can try something like this.
$('a.download').attr('href', 'data:application/csv;charset=utf-8,'+$scope.data);
I had the same issue and finally I solved in all browsers serving the CSV file in the server-side:
For anybody looking for a client-side solution using Javascript only, here is mine, working on any brother except IE 10 and lower (and Edge .. Concurrent engineering best practices. why ?!) :