获取原始文件名 google app engine

2022-11-26Python开发问题
2

本文介绍了获取原始文件名 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End
游戏宣传 you

相关推荐

Seborn FactGrid子图的一个共享x轴标签(布局/间距?)
One shared x-axis label for Seaborn FacetGrid subplots (layouts/spacing?)(Seborn FactGrid子图的一个共享x轴标签(布局/间距?))...
2024-08-20 Python开发问题
1

您如何修复“runtimeError:包无法通过健全性检查"?对于 numpy 和 pandas?
How do you fix quot;runtimeError: package fails to pass a sanity checkquot; for numpy and pandas?(您如何修复“runtimeError:包无法通过健全性检查?对于 numpy 和 pandas?)...
2024-04-21 Python开发问题
10

Django-注册&amp;Django-Profile,使用您自己的自定义表单
Django-Registration amp; Django-Profile, using your own custom form(Django-注册amp;Django-Profile,使用您自己的自定义表单)...
2024-04-21 Python开发问题
1

你如何在 django 网站上记录服务器错误
How do you log server errors on django sites(你如何在 django 网站上记录服务器错误)...
2024-04-21 Python开发问题
1

当你比较 2 个 pandas 系列时会发生什么
What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)...
2023-11-08 Python开发问题
1

在列表中查找最旧/最年轻的日期时间对象
Find oldest/youngest datetime object in a list(在列表中查找最旧/最年轻的日期时间对象)...
2023-11-08 Python开发问题
4