Blueimp File Upload: add image from URL

前提是你 提交于 2019-12-06 06:28:01

You have to find a way to download the image from the URL, convert the img into any Type supported by the blob constructor, build a blob file, and call the jQuery File Upload add method like $('#fileupload').fileupload('add', {files: blob})', all grammatically with javascript.

Check this out: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob and this http://qnimate.com/javascript-create-file-object-from-url/

If you manage to implement it, please post here.

Try something like this

var blob = null;
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://path/to/image');
xhr.responseType = 'blob';
xhr.onload = function()
{
   blob = xhr.response;
   $('#mediafile-file-fileupload').fileupload('add', {files: [blob]})
}
xhr.send();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!