直接将数据放入AppEngine的Blobstore中 [英] Directly Putting Data in AppEngine's Blobstore

查看:81
本文介绍了直接将数据放入AppEngine的Blobstore中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AppEngine的标准API假定文件是从HTML表单上传的。
我试图从一个可以由非Html客户端(Flash,iPhone等)调用的REST API方法将文件发布到blobstore。



我尝试工作的代码:

 #获取blobstore上传url 
upload_url = blobstore。 create_upload_url( /活动/ upload_finished);

#同步调用blobstore url来发布我们的图片
result = urlfetch.fetch(url = upload_url,
payload = request.FILES,
method = urlfetch.POST,
headers = {'Content-Type':'multipart / form-data'})

我收到以下错误:


ValueError:中的边界无效
blockquote>

任何想法?

有没有人试图通过web表单发布到blobstore?


多部分形式:''



解决方案

App Engine(版本1.4.3)允许您直接将数据写入Blobstore

a>。

您不再需要使用上传url方法。

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: ''

解决方案

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.

这篇关于直接将数据放入AppEngine的Blobstore中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆