本文介紹了獲取原始文件名 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!