Monday, August 24, 2009

cherrypy file upload

A common thing to do with web applications is to upload files. People want to upload their pdfs, upload their images, their word documents etc.

With cherrypy you can upload files using a few different ways...

This method for uploading files with cherrypy seems a pretty good way *1.

This tool lets you upload a file directly to disk... which is handy if you're uploading a very large file. This means the webserver doesn't need to write it all into memory, and that it doesn't need to copy the file when it's finished uploading.

*1 However there are some security, and usability issues with this cherrypy tool(as currently written). Can you spot what they are?


fumanchu said...

Just wait til 3.2 gets out the door: we've completely replaced the cgi module, so you should be able to take advantage of the core framework's MIME parsing but read the bytes right off the socket yourself. See for an overview.

illume said...

Sounds good :)