I have an App Engine application that stores users profile pictures using the blobstore. When I upload images from a form in Chrome it works fine. When I try to upload an image from an Android application it fails. Contrary to this question, using the android app to upload to my dev server also doesn't work.
My app engine server follows the guide at this link. My android upload code is based upon apache httpcore and httpmime from this link.
This is the successful request from Chrome:
self.request.params:
UnicodeMultiDict([(u'usersid', u'xxxxx'), (u'profilePicUpload', FieldStorage(u'profilePicUpload', u'image.png'))])
self.request.headers:
{'Origin': 'https://site.appspot.com', 'Accept-Language': 'en-GB,en-US;q=0.8,en;q=0.6',
'X-Appengine-Blobchunksize': '9521', 'X-Requested-With': 'XMLHttpRequest',
'X-Appengine-Blobupload': 'true', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (X11;
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36',
'Host': 'site.appspot.com', 'Cookie': 'xxxxx', 'Content_Type': 'multipart/form-data;
boundary=001a11333c426e860104f972b1fc', 'Referer': 'https://site.appspot.com/profile',
'Content-Type': 'multipart/form-data; boundary=001a11333c426e860104f972b1fc',
'X-Appengine-Country': 'ZZ', 'X-Appengine-Blobsize': '9521'}
self.request.body:
--001a11333c426e860104f972b1fc
Content-Disposition: form-data; name="usersid"
xxxxx
--001a11333c426e860104f972b1fc
Content-Disposition: form-data; name="profilePicUpload"; filename="image.png"
Content-type: message/external-body; blob-key="xxxxx" ...
This is the unsuccessful request from Android:
self.request.params:
UnicodeMultiDict([(u'usersid', u'xxxxx'), (u'profilePicUpload', FieldStorage(u'profilePicUpload', u'image.jpg'))])
self.request.headers:
{'Content_Length': '2103726', 'User-Agent': 'Apache-HttpClient/UNAVAILABLE (java 1.4)',
'Host': 'site.appspot.com', 'Content_Type': 'multipart/form-data;
boundary=cn2wRMd4fQphmeBcsYsjjJH7wfDtPm', 'X-Appengine-Region': 'eng', 'X-Appengine-City':
'crawley', 'X-Appengine-Citylatlong': '51.109140,-0.187227', 'Content-Type':
'multipart/form-data; boundary=cn2wRMd4fQphmeBcsYsjjJH7wfDtPm', 'X-Appengine-Country': 'GB'}
self.request.body:
--cn2wRMd4fQphmeBcsYsjjJH7wfDtPm
Content-Disposition: form-data; name="usersid"
xxxxx
--cn2wRMd4fQphmeBcsYsjjJH7wfDtPm
Content-Disposition: form-data; name="profilePicUpload"; filename="image.jpg"
Content-type: application/octet-stream
....
self.get_uploads() returns an empty list for the second case. Any ideas why?
As you can see, I don't have a missing space before filename as in this question.