Google App Engine の POST で値が取得できない(´;ω;`)ブワッ
やろうとしていることは、ドラッグ&ドロップされたファイルを
JavaScript で Google App Spot に送ろうとしたところ
ローカルの環境だとうまくPOSTした値を取得できるのに
なぜか App Spot にあげると動作しない。
もとにしたファイルは(PHPですが...)↓
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/
self.request.body で POST の中身を確認
http://www.kanzaki.com/docs/html/htminfo32.html
self.request.body: ---hellojapan12341332864958592; Content-Disposition: form-data; name="pr_key" ---hellojapan12341332864958592; Content-Disposition: form-data; name="before_or_after" ---hellojapan12341332864958592; ...
... 何もはいっていない。
JavaScript の alert で表示させてみる
あれ?詰めて書かれてる(´・ω・`)
---hellojapan12341332864958592; Content-Disposition: form-data; name="pr_key" fakfkljkljga ---hellojapan12341332864958592; Content-Disposition: form-data; name="before_or_after" before ---hellojapan12341332864958592; Content-Disposition: form-data; name="pic"; filename="image.jpeg" ...
下サンプルと比較
エンコードのタイプとファイル送信
http://www.kanzaki.com/docs/html/htminfo32.html#enctype
1行あけるとちゃんと値を取るようになった。
---hellojapan12341332864958592; Content-Disposition: form-data; name="pr_key" fakfkljkljga ---hellojapan12341332864958592; Content-Disposition: form-data; name="before_or_after" before ---hellojapan12341332864958592; Content-Disposition: form-data; name="pic"; filename="image.jpeg" ...