Directly Putting Data in AppEngine's Blobstore
Asked Answered
C

2

6

The AppEngine's standard API assumes files are uploaded from an HTML form. I'm trying to post a file to the blobstore from a REST API method that can be called by a non Html client (Flash, iPhone, etc.)

The code I'm trying to get working:

# Get the blobstore upload url    
upload_url = blobstore.create_upload_url("/activities/upload_finished");

# Make sync call to the blobstore url to post our image
result = urlfetch.fetch(url=upload_url,
                        payload=request.FILES,
                        method=urlfetch.POST,
                        headers={'Content-Type': 'multipart/form-data'})

I'm getting the following error:

ValueError: Invalid boundary in

Any idea?
Has anyone tried posting to the blobstore not through a web form?

multipart form: ''

Crinkumcrankum answered 27/1, 2010 at 18:2 Comment(0)
I
7

App Engine (version 1.4.3) allows you to directly write data to the blobstore.
You no longer need to use the upload url method.

Indore answered 7/9, 2010 at 21:9 Comment(3)
right, please notice hat this feature is marked as Experimental (don't know what does it mean)Denti
@Yonatan It means "Don't come crying if it doesn't work and break your site" :) and also "We might change the API until final relase"Indore
looks like it's deprecated nowGush
R
4

You can't make a regular post into a multipart form simply by specifying the content type - you're just submitting URL-encoded data with the wrong content type.

You'll need to assemble a proper multipart form - using the email module or by hand, like this.

Also see this question.

Restriction answered 28/1, 2010 at 8:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.