i want take image url entered text box user , save file server.
so far i've saved files users this...
var myformdata; document.getelementbyid("fileinput").onchange = function () { myformdata = new formdata(); myformdata.append('uploadfile', $("#fileinput").prop('files')[0]); $.ajax({ url: '/php/uploadfile.php', type: 'post', processdata: false, contenttype: false, datatype : 'text', data: myformdata, success: function(response){ }, error: function(response){ } }); } };
but of course works when user chooses via input of type="file", , i've learned other posts security reasons it's impossible programatically set value of $("#fileinput").prop('files')[0].
so seems achieve need way convert img have (e.g. http://www.imageexamples.com/image1.jpg) file can append form , upload via ajax. sound correct way go? if so, i've been struggling find examples of others doing it, appreciate pointers @ all!
sop prevent downloading images arbitrary websites ajax.
should send url server , let server download , store image.
Comments
Post a Comment