如何将blob数据发布到php文件并插入数据库?

I have managed to convert base64 image to blob image, and this works fine my question is how to post the blob image to php file and the insert it into the database... Here is my blob image example (blob:http%3A//localhost/acc6ed62-fa5c-4eaa-951e-9910eb57ad2f); here is ajax code::

function Post_Image(){  
//This image has a base64 src           
var image = $('.img').attr('src');
var contentType = 'image/png';
var b64Data = image.replace(/^data:image\/(png|jpg);base64,/, "");
//converting base64 to blob
var blob = b64toBlob(b64Data, contentType);
//The result from blobUrl= blob:http%3A//localhost/acc6ed62-fa5c-4eaa-951e-9910eb57ad2f
//This url will be posted to the server
var blobUrl = URL.createObjectURL(blob);  
var formData = new FormData();
formData.append('userImage', blobUrl);
$.ajax({
    url: 'wow.php',
    type: 'GET',
    data: {userImage:blobUrl},
    success:function(data){

    }
});

}

查看全部
duan198123
duan198123
2016/07/24 22:43
  • php
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

0个回复