Open links made by createObjectURL in IE11

This demo uses Blob URL which is not supported by IE due to security restrictions. IE has its own API for creating and downloading files, which is called msSaveOrOpenBlob. Here is my cross-browser solution that works on IE, Chrome and Firefox: function createDownloadLink(anchorSelector, str, fileName){ if(window.navigator.msSaveOrOpenBlob) { var fileData = [str]; blobObject = new Blob(fileData); … Read more

How to Display blob (.pdf) in an AngularJS app

First of all you need to set the responseType to arraybuffer. This is required if you want to create a blob of your data. See Sending_and_Receiving_Binary_Data. So your code will look like this: $http.post(‘/postUrlHere’,{myParams}, {responseType:’arraybuffer’}) .success(function (response) { var file = new Blob([response], {type: ‘application/pdf’}); var fileURL = URL.createObjectURL(file); }); The next part is, you … Read more

How can I store and retrieve images from a MySQL database using PHP?

First you create a MySQL table to store images, like for example: create table testblob ( image_id tinyint(3) not null default ‘0’, image_type varchar(25) not null default ”, image blob not null, image_size varchar(25) not null default ”, image_ctgy varchar(25) not null default ”, image_name varchar(50) not null default ” ); Then you can write … Read more

how to store Image as blob in Sqlite & how to retrieve it?

Here the code i used for my app This code will take a image from url and convert is to a byte array byte[] logoImage = getLogoImage(IMAGEURL); private byte[] getLogoImage(String url){ try { URL imageUrl = new URL(url); URLConnection ucon = imageUrl.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new … Read more

JavaScript blob filename without link

The only way I’m aware of is the trick used by FileSaver.js: Create a hidden <a> tag. Set its href attribute to the blob’s URL. Set its download attribute to the filename. Click on the <a> tag. Here is a simplified example (jsfiddle): var saveData = (function () { var a = document.createElement(“a”); document.body.appendChild(a); a.style … Read more