Javascript code:
$http({
method: 'POST',
url: 'some/path',
headers: { 'Content-Type': false },
transformRequest: function (data) {
var formData = new FormData();
formData.append("file", data);
return formData;
},
data: file
}).
success(function (data, status, headers, config) {
alert("success!");
}).
error(function (data, status, headers, config) {
alert("failed!");
});
Server code:
func addImageHandler(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
blobs, _, err := blobstore.ParseUpload(r)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
file := blobs["file"]
....
}
I'm hitting the handler just fine but when i parse the upload I don't have any files in my blobs map. Is there something obvious i'm missing?
Thanks!