duan198123 2016-07-24 22:43
浏览 159

如何将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){

    }
});

}

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败