- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我目前正在 GAE Blobstore 中存储一堆 .docx 文件。我最近注意到,这些文件在某些计算机(IE 9 for Windows 7)上下载时没有文件扩展名,但在其他计算机(IE 8、Chrome for Windows 7)上工作正常。
以下是文件在 blobstore 中的存储方式:
f = files.blobstore.create(mime_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document',
_blobinfo_uploaded_filename=filename)
## then some code to write data and save ##
这是来自 Chrome 检查器的文件的响应 header :
Cache-Control:no-cache
Content-Disposition:attachment; filename="causes_of_ww1_emanresu"
Content-Length:12120
Content-Type:application/vnd.openxmlformats-officedocument.wordprocessingml.document
Date:Fri, 26 Oct 2012 23:54:09 GMT
Server:Google Frontend
X-AppEngine-Estimated-CPM-US-Dollars:$0.000033
X-AppEngine-Resource-Usage:ms=15 cpu_ms=0
以下是我为 blob 提供服务的方式:
self.send_blob(blob_info, save_as=blob_info.filename, content_type=blob_info.content_type)
我什至尝试硬编码 content_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document'
无济于事。
关于发生了什么以及如何解决它有什么想法吗?
根据要求,这是我在最初保存 blob 时获取文件信息的方式。我很确定这个级别没有发生错误,但这是问题的前兆:
# get the file from a file_url with urlfetch
result = urlfetch.fetch(file_url)
headers = result.headers
# some custom functions to return a filename
username = self.get_username()
filename = get_filename(title, username)
# write the file to blobstore
f = files.blobstore.create(mime_type=headers['content-type'],
_blobinfo_uploaded_filename=filename)
with files.open(f, 'a') as data:
data.write(result.content)
files.finalize(f)
blob_key = files.blobstore.get_blob_key(f)
最佳答案
啊,根据顶部的评论,解决方案是将文件扩展名添加到 BlobInfo 的文件名属性中。我最初没有意识到这是必要的,因为 Chrome 在下载时会自动添加文件扩展名。
关于internet-explorer - GAE 从 blobstore 下载文件扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13095944/
我正在 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。在导入过程中,应该抓取图像并将
我是一名优秀的程序员,十分优秀!