[Twisted-web] twisted.web : limiting file size during upload (using python)

Pranav Bhardwaj pranavb85 at gmail.com
Tue Jul 16 18:58:57 MDT 2013


Hey

I have a script to be able to upload logs to a twisted web server.

I have the following requirements:

1) to be able to limit the size of the upload to 10MB.
2)  to NOT store file in memory during the request.

Does twisted.web provide these functionality?

Any inputs on these would be welcome!



Here is the *server part* os the script:

        try:
            oStream = open(filename, 'wb')
            oStream.write(request.args['fname'][0])
            outputStream.close()

        except:
            # handle exception


a test *client script:*


<!DOCTYPE html>
<html>
<form action="https://serverUrl"
enctype="multipart/form-data"
method="post">
<div class="row">
<label for="fileUploadToServer">Select file</label><br />
fname : <input type="file" name="fname" />
<input type="submit" value="submit">
</div>
</form>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-web/attachments/20130716/c98fbba9/attachment.html>


More information about the Twisted-web mailing list