[Twisted-Python] Twisted file upload
syver at inout.no
Thu Oct 16 05:37:13 EDT 2003
"Thomas Weholt" <2002 at weholt.org> writes:
> If anybody can elaborate on this, provide a simple, twisted-friendly way of
> parsing uploaded files, preferrably in a form with other fields as well,
> that would be great.
> Been messing around with something similar to this myself, and I have to
> upload mainly binary files, which in my case returned just crappy, mangled
The support works out of the box for me as long as I use the correct
enctype on the form. I just use request.args to get the data, it's the
filename that I have a problem with.
<form enctype="multipart/form-data" action="./" method="POST">
<input name="myFile" type="file" />
<input type="submit" value="Upload file" />
When I get the POST I just use:
outputStream = open(filename, 'wb')
I find filename by doing the stuff outlined in the beginning of this thread.
More information about the Twisted-Python