server console
# 試験系
POST
ImmutableMultiDict([('img', <FileStorage: u'' ('application/octet-stream')>)])
<FileStorage: u'' ('application/octet-stream')>
124.35.46.4 - - [12/Sep/2013 00:28:31] "POST /upload HTTP/1.1" 500 -
# 正常系
POST
ImmutableMultiDict([('img', <FileStorage: u'sample03.png' ('image/png')>)])
<FileStorage: u'sample03.png' ('image/png')>
124.35.46.4 - - [12/Sep/2013 00:28:49] "POST /upload HTTP/1.1" 200 -
client code
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://myhost.com:9999/upload');
var form = document.createElement('form');
var input = document.createElement('input');
input.type = 'file';
input.name = 'img';
//input.value = dataUrl;
form.appendChild(input);
var data = new FormData(form);
xhr.send(data);
xhr.addEventListener('load',function(ev){
if(xhr.status !== 200) return alert(xhr.status);
alert(xhr.response);
});
http://uhyohyohyo.sakura.ne.jp/javascript/13_1.html