开发者

XMLHttpRequest upload photo from remote host

I am trying to either upload photo from remote server or from inline binary code. So far, not so lucky. This is the code I have so far:

https://gist.github.com/0574acf26e88fcadecbf [I've tried pasting on sof, but it seems like sof didn't like the inlin开发者_如何学JAVAe binary code]

The image here is 1x1 PNG. Any solutions, like making the binary code base64 encrypted, etc. to prevent problem with inline-binary, are appreciated.

Summary: The script in question will be executed from javascript: browser URL bar. The script has to submit multipart/form-data with image inline/remotely hosted.


I ended up using server-side form to encrypt my image to base64 string. Then using native browser function to decrypt base64 string when sending it trough XHR. Works with small images, though, it is quite problematic with +100 Kb images.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜