I've just completed a project that does uploading of files. What I found (through experimentation, unfortunately) was that, in addition to Todd's recommendation below, what was sent to the server was browser dependent -- Safari and Chrome work one way, Firefox another. I'll probably write something in my blog and post a link here in a couple of days.
On Jun 8, 12:06 am, Ian Lewis <[email protected]> wrote: > did something like self.request.FILES["myfile"].name not work? > > Since uploading files is a fairly common use case, would it be a good idea > to get this added to the documentation? > > > > > > On Mon, Jun 8, 2009 at 3:59 AM, Todd <[email protected]> wrote: > > > It took me hours to discover this, and I wanted to share, since I > > could not find it anywhere else on the net. > > > To get the filename of an uploaded file ( via the Content-Disposition > > in the HTTP POST ), use: > > > self.request.params[<form element name with file>].filename > > > I suppose this may have been obvious to some, but using > > self.request.get() always returns the String value of the form > > parameter. Appengine overrides the WebOb request to abstract the > > cgi.FieldStorage object ( which holds the filename ) from you. > > > Hope this helps. > > > -Todd > > -- > ======================================= > 株式会社ビープラウド イアン・ルイス > 〒150-0012 > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > email: [email protected] > TEL:03-5795-2707 > FAX:03-5795-2708http://www.beproud.jp/ > ======================================= --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
