angularjs - Alternative for File() constructor for safari -
i using file() constructor creating file object uploading blob file server, code works fine chrome, fails safari , internet explorer. following line of code:
image_url = new file([blob],file_name,{type: mimestring});
code breaking @ line , getting error in console "fileconstructor not constructor (evaluating 'new file([blob],file_name,{type: mimestring})')"
using filereader api alternative not able fix issue.
help appreciated. thanks.
i suggest use blob api, i've found same problem , solved that:
var html = <svg>whatever on svg </svg> var filename = "myfile.svg"; var blob = new blob([html], {type: 'image/svg'}); blob.lastmodifieddate = new date(); // var blobattrs = {type: "image/svg"}; // var file = new file([html], filename, blobattrs); var formdata = new formdata(); formdata.append("file",blob,filename);
it not "file", can use was.
Comments
Post a Comment