I'm using web.py master retrieved about 2 or 3 weeks ago. So before you go on to read the rest, if file uploading doesn't work (the way it is described in the cookbook at least) in the master for some reason, please tell me so, and I'll switch back to .33
Here's my app.py: http://dpaste.com/150637/ And the template: http://dpaste.com/150638/ As you can see I've tried to keep things as simple as possible while also realistic enough to reflect a real app that I'm having trouble with right now, and to rule out any other factors than those that are effective in this example. The result I get is an exception: 'str' object has no attribute 'filename' Here's the full traceback: http://0.0.0.0:8080/ 127.0.0.1:1436 - - [26/Jan/2010 12:38:38] "HTTP/1.1 GET /" - 200 OK Traceback (most recent call last): File "C:\Python26\Lib\site-packages\web\application.py", line 242, in process return self.handle() File "C:\Python26\Lib\site-packages\web\application.py", line 233, in handle return self._delegate(fn, self.fvars, args) File "C:\Python26\Lib\site-packages\web\application.py", line 412, in _delegate return handle_class(cls) File "C:\Python26\Lib\site-packages\web\application.py", line 387, in handle_class return tocall(*args) File "C:\Documents and Settings\vukelicb\My Documents\code\upload\app.py", line 25, in POST file = open(i.file.filename, 'wb') AttributeError: 'str' object has no attribute 'filename' 127.0.0.1:1436 - - [26/Jan/2010 12:38:43] "HTTP/1.1 POST /" - 500 Internal Server Error The input object has only two keys, 'file' and 'submit'. The value of the file object is a string that presumably contains the file contents, and looks like this: '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00Y\x00Y\x00\x00\xff\xdb\x00C\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x01\x01\x01\x01\x01\x02\x01\x01\x01\x02\x02\x02\x02\x02\x02\x02\x02\x02\x03\x03\x04\x03\x03\x03\x03\x03\x02\x02\x03\x04\x03\x03\x04\x04\x04\x04\x04\x02\x03\x05\x05\x04\x04\x05\x04\x04\x04\x04\xff\xdb\x00C\x01\x01\x01\x01\x01\x01\x01\x02\x01\x01\x02\x04\x03\x02\x03\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\....' -- Branko Vukelić http://foxbunny.tumblr.com/ http://www.flickr.com/photos/16889...@n04/ http://www.twitter.com/foxbunny http://github.com/foxbunny -- You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en.
