Programmatic file upload with jQuery-File-Upload

2019-08-23 06:29发布

I use jQuery-File-Upload plugin for uploading the images. now I create an image from canvas und would like to use the same mechanismus to transfer this image to the server. In jQuery-File-Upload documentation I found the way to use the fileUpload component programatically but it expects the list of files as parameters

     $('#fileupload').fileupload('send', {files: filesList});

in my case I have the image in form of base64.

       var image = canvas.toDataURL();

how can I use fileUpload component to transfer my canvas image?

1条回答
戒情不戒烟
2楼-- · 2019-08-23 06:42

Just send it as POST data, then on the server side decode it from Base64 and save it as a png ( which I think is the default type ) but the mime-type of the file will be at the start of the base-64!

查看更多
登录 后发表回答