Hi group :)

I just added an uploading capability to my web application and guess  
what - it does not work :/
At first, I'll give you the exception/traceback I get on the terminal:

        Traceback (most recent call last):
        File "/Library/Python/2.5/site-packages/web/webapi.py", line 304, in  
wsgifunc result = func()
        File "/Library/Python/2.5/site-packages/web/request.py", line 129, in  
<lambda> func = lambda: handle(getattr(mod, name), mod)
        File "/Library/Python/2.5/site-packages/web/request.py", line 61, in  
handle return tocall(*([x and urllib.unquote(x) for x in args] + fna))
        File "/Library/Python/2.5/site-packages/web/request.py", line 106, in  
internal return getattr(self, func)(*args)
        File "/Path/to/webapp/SpecialHandler.py", line 386, in  
POST_SH_UploadFile i = web.input(file={})
        File "/Library/Python/2.5/site-packages/web/webapi.py", line 104, in  
input a = cgi.FieldStorage(fp = StringIO(data()), environ=e,
        File "/Library/Python/2.5/site-packages/web/webapi.py", line 123, in  
data ctx.data = ctx.env['wsgi.input'].read(cl)
        File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/socket.py", line 309, in read data =  
self._sock.recv(recv_size) timeout: timed out

The code I am using for uploading on the python side is (for testing  
at first...):

        def POST_SH_UploadFile(SpecialHandler, params):
                login = Login()
                i = web.input(file={})
                if login.loggedIn():
                        open("./StaticContent/uploads/testfile",  
'wb').write(web.input().thefile)
                        web.seeother("/")
                else: forbidden()

My HTML code is:

        <form name="fileUploadForm" enctype="multipart/form-data"  
method="post" action="/Special/UploadFile/">
                <strong>File:</strong> <input type="file" name="thefile" />
                <button type="submit" class="commitButton">Upload</button>
                <button type="reset" class="cancelButton">Cancel</button>
        </form>

Can anyone tell me what I am doing wrong?
As the app is failing on the web.input(...) line, I tried removing the  
file={} statement in web.input(),
but this does not affect the situation in any way.
I'm using MacOS 10.5, current web.py version and Python 2.5.

Thanks in advance for your help!

cheers,
ulrik

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to