问题描述
blobstore.parse_file_info(cgi.FieldStorage()['file'])方法对BlobstoreUploadHandler不起作用,FieldStorage似乎用于常规上传。
blob_info中没有gcs文件名信息,self.get_uploads提供的常规blob_info提供了一个gbs文件名信息似乎只有一个blob_key可以使用常规方法访问,但似乎只有一个blob_key为未来最安全的赌注
如何使用gs_bucket_name参数从blobstore.create_upload_url上传到url的文件的gcs file_name?
class UploadAPI(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
file_info = self.get_file_infos()[0]
rtn_data = {
filename:file_info.filename,
content_type:file_info.content_type,
creation :file_info.creation,
size:file_info.s ize,
md5_hash:file_info.md5_hash,
gs_object_name:file_info.gs_object_name
}
我在代码中找到了用法,但我也找不到文档。
在
说。
但是没有任何与 FileInfo
相关的信息,我可以在 BlobstoreUploadHandler
blobstore.parse_file_info(cgi.FieldStorage()['file']) method doesn't work for BlobstoreUploadHandler, the FieldStorage seems to be for regular uploads
There is no gcs filename information inside the blob_info that the regular blob_info from self.get_uploads provides
It seems only a blob_key can be accessed using the regular methods, however a gcs file_name seems to be the safest bet for future
How can I get gcs file_name of a file uploaded to an url from blobstore.create_upload_url with gs_bucket_name argument?
class UploadAPI(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
file_info = self.get_file_infos()[0]
rtn_data = {
"filename": file_info.filename,
"content_type": file_info.content_type,
"creation": file_info.creation,
"size": file_info.size,
"md5_hash": file_info.md5_hash,
"gs_object_name": file_info.gs_object_name
}
I did find the usage in code, but I cannot find document either.
Inhttps://developers.google.com/appengine/docs/python/blobstore/fileinfoclass said.
But there is nothing related to FileInfo
I can find in document of BlobstoreUploadHandler
https://developers.google.com/appengine/docs/python/tools/webapp/blobstorehandlers
这篇关于如何获取通过BlobstoreUploadHandler上传的文件的FileInfo / gcs file_name?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!