获取原文件名谷歌应用程序引擎 [英] Get original filename google app engine

查看:98
本文介绍了获取原文件名谷歌应用程序引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Google应用引擎上接收文件上传时,示例假定您收到一个.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" />

在您的Handler中,您可以找到文件名称:

Inside your Handler, you could find the name of the file with:

filename = self.request.POST["content"].filename

这篇关于获取原文件名谷歌应用程序引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆