上传帆布数据S3 [英] upload canvas data to s3
问题描述
现在,因为亚马逊已经启用 CORS
我在想,如果这是可能的。
Now since the amazon has enabled CORS
I was wondering if this is possible.
可以在HTML 画布
数据(客户端浏览器)转换为的东西
并上传到直接S3?
Can the html canvas
data (on client browser) be converted to a something
and uploaded to s3 directly ?
我相信,我可以做一个 PUT
要求亚马逊但是这需要一个文件
。
I am sure I can make a PUT
request to amazon but that requires a File
.
我能获得的base64
连接codeD图像数据,甚至是的Blob
但有一种方式来这是将图像保存到 S3
从客户端浏览器?
I can get base64
encoded image data or even a Blob
but is there a way to save this as an image to S3
from the client browser ?
有没有一种方法来转换画布
到文件
,这样我可以做一个 PUT
请求或方式,亚马逊理解的Blob
,并将其保存为图像?
Is there a way to convert canvas
to File
so that I can make a PUT
request or a way that amazon understands Blob
and saves it as an image ?
推荐答案
有一个老帖子方法从浏览器数据上传到S3
There is an old post method to upload data from browser to s3
http://s3.amazonaws.com /doc/s3-example-$c$c/post/post_sample.html
然后我用这个想法 <一href="http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata">Convert数据URI到文件,然后附加到FORMDATA
和,而不是正常的 POST
有可能与FORMDATA亚马逊的XHR请求,就大功告成了。
and instead of normal POST
there can be an xhr request with the formdata to amazon and you are done
这篇关于上传帆布数据S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!