- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以我正在尝试将 filepicker.io 与 GAE 应用程序一起使用。文件选择器小部件返回用户上传的文件的 URL。
然后我如何使用此 url 将文件上传到 GAE 的 blobstore?
blobstore 只支持“通过表单上传文件”,所以真正的问题是如何伪造一个包含文件 URL 的表单 POST。
最佳答案
伪造表单帖子是可能的,但使用 Files API 会简单得多
编辑:
要将 File API 与 urlfetch 结合使用,您需要编写如下内容:
from __future__ import with_statement
from google.appengine.api import files
from google.appengine.api import urlfetch
url = "http://www.facebook.com/somephoto.png"
result = urlfetch.fetch(url)
if result.status_code not 200:
return "some error"
# Create the file
file_name = files.blobstore.create(mime_type='application/octet-stream')
# Open the file and write to it
with files.open(file_name, 'a') as f:
f.write(result.content)
# Finalize the file. Do this before attempting to read it.
files.finalize(file_name)
# Get the file's blob key
blob_key = files.blobstore.get_blob_key(file_name)
我还没有对此进行测试 - 所以如果这不起作用,请告诉我。
此外,我相信您可以将 mime_type 保留为“application/octet-stream”,App Engine 将尝试猜测正确的类型。如果这不起作用,请尝试将其更改为“image/png”。或者对于 pdf,mime 类型将是 'application/pdf'
关于google-app-engine - 如何将 filepicker.io 与谷歌应用引擎 (blobstore) 集成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12149315/
我正在 appengine 中开发一个应用程序,我们希望能够向离线用户提供内容。这意味着我们需要获取所有使用过的 blobstore 文件并为离线用户保存它们。我使用服务器端来执行此操作,以便只执行一
" method="post" enctype="multipart/form-data" >
我确实需要上传大于 1 Mb 的文件,所以我只有 Blobstore API。但在生产中使用它吗?知道任何问题吗? 最佳答案 我很高兴地使用了 Google 内部的等效功能(我在 Google 工作)
我想从另一个站点获取图像 (~250Kb) 并将它们保存到 blobstore 。我想使用 Blobstore,因为它的配额(5Gb 免费)与数据存储(1Gb 免费)相比。我该怎么做? GAE 文档说
我正在尝试将表单中的多个文件上传到 BlobStore。 表格: Key Name name image thumb 然后我尝试为每个上传的文件获取 BlobInfo 对象:
在我的应用程序中,我需要执行以下操作:1. 将包含图像(目前只有 jpg)和其他内容的 zip 文件上传到 BlobStore。2. 应用引擎后端应从上传的 zip 中读取条目,并将在其中找到的所有图
我正在尝试对一些使用 Blobstore API 的代码进行单元测试,但是我收到此代码的 NullPointerException : @ContextConfiguration(locations
在接下来的几天里,我必须开始编写一些报告生成函数。我需要写入调用是原子的,并让我知道存储时是否出现故障。 appengine 上的一项实验性功能允许使用 blobstore 作为文件系统。(https
上传文件名包含空格且不带文件扩展名的文本文件会引发以下异常。文件名类似于“README TXT”或“ABC DEF”。 使用 Blobstore 示例可以重现此问题。 https://develope
我有这个上传文件的jsp 文件。我添加了姓名和电子邮件表格。我希望能够跟踪上传到我的应用程序引擎 blobstore 的哪个 blob 来自哪个人。我是否必须绑定(bind)数据存储才能获取联系信息?
我尝试使用下面的代码使用curl将图像上传到blobstore,但收到以下错误“必须从blob上传回调请求调用”。 但是,如果我使用带有操作的表单,它会上传: blobstoreService.cre
我正在将数据上传到 blobstore。它应该只暂时停留在那里,并从我的 AppEngine 应用程序中上传到 Amazon S3。 看来我只能通过 BlobDonwloadHandler 获取数据,
我目前正在 Appengine 中制作一个图像共享网站,它主要按照我想要的方式工作,但有时我想要一个小版本的图像(缩略图) - 目前我正在使用 HTML 缩小它,但是当完全没有必要时,浏览器仍然会加载
我可以使用 python 中的 uploadhandler 上传文件。当我尝试获取文件的 url 时,我收到错误“Assertionerror images the service does not
关注此blobstore document 关于如何上传到 Blobstore。它显示了通过JSP + Servlet 方式上传。 由于我的应用程序基于 GWT,因此我需要调整 GWT RPC(而不是
假设我有一些文件上传表单,例如文档中的文件 https://cloud.google.com/appengine/docs/java/blobstore/ 如果我将文件 file.txt 保存到 bl
我想使用 BlobstoreInputStream 从 Blobstore 一次读取一行文本并处理该文本 123,ABC,DEF,GHI,JKL,123,456,789,123\r\n 但是 Blob
我阅读了文档,四处搜索,但仍然不知道如何将 blob 读取为字节数组。 我能够生成 PDF 文件并将它们存储在 blobstore 中。我还可以使用 serve() 为这些 blob 提供下载服务,没
我正在阅读有关 Google App Engine 中的 Blobstore 的信息。下面的代码来自示例文档。用户选择要上传的文件并单击提交后,如何将 key 放入 javascript 变量中?我可
我正在尝试使用 taskqueue 和 deferred 将大型用户信息列表从 json 文件导入到数据存储区。 User 包含用户信息,包括来自不同应用的图像 url。在导入过程中,应该抓取图像并将
我是一名优秀的程序员,十分优秀!