How to set filename property in BlobStore?

亡梦爱人 提交于 2019-12-04 02:49:45
Kevin P

Parse the filename from the url (see related question here). Then you can set it by adding an additional parameter to your files.blobstore.create call:

file_name = files.blobstore.create(mime_type='image/png',_blobinfo_uploaded_filename=file_name_from_url)

I know this is an old question but ...

self.send_blob(blob_info,save_as=True) allows you instead of True, to specify a string. What that means is that the file will be served with the provided string as the filename. So one solution is for you to keep the filename along with the blobkey, and then when you serve these using send_blob, you provide the filename as an argument. You don't care how the file will be stored, you only care how it will be served.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!