Get original filename google app engine(获取原始文件名 google app engine)
问题描述
在谷歌应用引擎上接收文件上传时,示例 假设您收到的是 .png.但是,您只能通过文件名上的扩展名知道图像的类型.
When receiving a file upload on google app engine, the example assumes you're receiving a .png. However you only konw what the type of the image is by the extension on the filename.
如何获取上传到 GAE 的原始文件名?
How do you get the original filename uploaded on GAE?
推荐答案
正在上传的文件的文件名可以通过查看保存文件的变量的 filename 属性来确定.例如,假设您的表单有一个名为 content 的字段:
The filename of the file that is being uploaded can be determined by looking at the filename property of the variable that holds the file. For example, let's say that your form has a field named content:
<input type="file" name="content" />
在您的处理程序中,您可以通过以下方式找到文件的名称:
Inside your Handler, you could find the name of the file with:
filename = self.request.POST["content"].filename
这篇关于获取原始文件名 google app engine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:获取原始文件名 google app engine


基础教程推荐
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01