私はブロブとして表示された画像を持っています:
<img id="imgcaptmobile" width="487" src="blob:http%3A//www.mysite.com/ab750f54-ecb4-4dc9-8d9d-4e28c4a41262">
jquery ajaxで画像をファイルとしてアップロードするにはどうすればよいですか?...
私はブロブとして表示された画像を持っています:
<img id="imgcaptmobile" width="487" src="blob:http%3A//www.mysite.com/ab750f54-ecb4-4dc9-8d9d-4e28c4a41262">
jquery ajaxで画像をファイルとしてアップロードするにはどうすればよいですか?...
これを試して
var blobURL = "blob:http%3A//www.mysite.com/ab750f54-ecb4-4dc9-8d9d-4e28c4a41262";
var image = new Image();
image.onload = function() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, image.width, image.height);
var picture = canvas.toDataURL("image/jpeg", 1.0);
var data = new FormData();
data.append("picture", picture);
$.ajax({
"url": "The Upload URL",
contentType: false,
processData: false,
type: 'POST',
"data": data,
success: function(response) {
//handle the response
}
});
}
image.src = blobURL;
<img src='blob:http%3A//www.mysite.com/ab750f54-ecb4-4dc9-8d9d-4e28c4a41262' />