Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get original filename google app engine

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.

How do you get the original filename uploaded on GAE?

like image 842
bobobobo Avatar asked Dec 22 '22 06:12

bobobobo


1 Answers

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
like image 110
Adam Crossland Avatar answered Jan 02 '23 01:01

Adam Crossland