My experience is that the blobstore corrupts in strange ways content that 
is not the uploaded file that it is meant to receive. 
I went through a litany of problems trying to have a form with an uploaded 
file being directed first to the blobstore (for upload storage), then to 
appengine (for form processing). 
The only reliable solution I have found is to do file uploads separate from 
all other data submission, so that the blobstore has no other data to 
corrupt. 

On Tuesday, November 19, 2013 7:40:37 AM UTC-8, Rich wrote:
>
> Hi, 
>
> I'm trying to include some additional data in a blobstore upload which I 
> can then process with the BlobInfo. According to 
> https://developers.google.com/appengine/docs/java/blobstore/ :
>
> *When the Blobstore rewrites the user's request, the MIME parts of the 
> uploaded files have their bodies emptied, and the blob key is added as a 
> MIME part header. All other form fields and parts are preserved and passed 
> to the upload handler. *
>
> This seems to be working fine on the Dev Server but *not* on the live 
> AppEngine. 
>
> Having got the upload URL from the blobstore service, on the client-side 
> I'm then doing:
>
> var formData = new FormData();
> formData.append("upload-request", JSON.stringify({
>   myExtraData: "something"
> }));
>
> for (var idx = 0; idx < files.length; idx++) {
>   formData.append(files[idx].name, files[idx]);
> }
>
> xhr.open("POST", uploadUrl);
> xhr.send(formData);
>
> And then trying to process it on the server side with:
>
> log.warning("isMultipartContent: " + 
> ServletFileUpload.isMultipartContent(req));
> ServletFileUpload upload = new ServletFileUpload();
> FileItemIterator iterator = upload.getItemIterator(req);
> int count = 0;
> while (iterator.hasNext()) {
>   ++count;
>   FileItemStream item = iterator.next();
>   if (item.isFormField()) {
>     log.warning("Got a form field: " + item.getFieldName());
>   } else {
>     log.warning("Got an uploaded file: " + item.getFieldName() +
>         ", name = " + item.getName());
>   }
> }
> log.warning("FileItem count = %s", count);
>
> When I run this on the local Dev server, everything works perfectly and it 
> happily logs both the form field part and the re-written (content-stripped) 
> file part and a count of 2.
>
> When I run it on the live App Engine, it logs:
> isMultipart: true
> FileItem count = 0
>
> It seems that the live server, contrary to the documentation, is stripping 
> all the mime parts from the request.
>
> Note, that the blobs are still retrievable 
> with blobstore.get{File,Blob}Infos(req), but I cannot access the additional 
> data that was sent with the request.
>
> Has anyone seen this before? Is this is a known bug or have I 
> misinterpreted the docs? Does anyone know if the same is true in the Python 
> runtime? Can anyone suggest a workaround?
>
> Thanks,
> Rich
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to