Domanda

I save the file to blobstore with

af_file = files.blobstore.create(mime_type=ctype, _blobinfo_uploaded_filename=my_file.filename)

(yes, I know that this is depreciated, but have no other choice since Google Cloud is not available for free)

So, I have the key in result. How could I extract _blobinfo_uploaded_filename value?

È stato utile?

Soluzione

You can get the filename and other properties from Blobinfo. Docs: https://developers.google.com/appengine/docs/python/blobstore/blobinfoclass?hl=nl#BlobInfo_properties

Example:

blob_info= blobstore.BlobInfo.get(blob_key)
file_name = blob_info.filename

You can use a blob upload as an alternative for create.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top