Re: Streaming uploads to temp files

2006-03-26 Thread Ivan Sagalaev
Istvan Albert wrote: >And by the way, thanks for the nice patch Ivan. I'm (re)writing an >application to Django and would have never done so had there not be >this hope that this issue will be settled properly. > > Then you will like another one :-). This week I'll try to implement a solution

Re: Streaming uploads to temp files

2006-03-26 Thread Istvan Albert
> But I have concerns about performance in the common case. File upload is inherently a slow process strictly limited by the connection speed so it is not clear that any kind of performace problems would be noticable at all (even if there were such problems) Loading files into memory is *extreme

Re: Streaming uploads to temp files

2006-03-11 Thread Ivan Sagalaev
luca wrote: >I'm sure you did but just for the record take a look at cherrypy >approach on this: http://www.cherrypy.org/wiki/FileUpload > > They do exactly the same thing: parse uploaded data with cgi.FieldStorage that streams them to a temp file. In fact there is still a problem with this a

Re: Streaming uploads to temp files

2006-03-11 Thread luca
Hi ! This is a great improvement I will try it asap. I'm sure you did but just for the record take a look at cherrypy approach on this: http://www.cherrypy.org/wiki/FileUpload After a simple recipe there is another that work very well, I've tested it on a local network with several iso images with

Re: Streaming uploads to temp files

2006-03-10 Thread Ivan Sagalaev
Ivan Sagalaev wrote: >Then it's not that much irrelevant :-). I'll make a setting for chosing >type of a storage but not for chunk size. > > I've submitted a patch. It even looks faster than email.Message even without disk storage. Can anyone please test it under magic-removal? --~--~---

Re: Streaming uploads to temp files

2006-03-10 Thread Ivan Sagalaev
Ivan Sagalaev wrote: >Looks like I was wrong. > And again :-( > It appears that cgi.FieldStorage stores content >in temp files only when uploaded parts have Content-length set. But >browser doesn't set it and FieldStorage reads data with readline() and >stores it in memory anyway. > > It do

Re: Streaming uploads to temp files

2006-03-10 Thread Ivan Sagalaev
Ivan Sagalaev wrote: >With streaming to temp files it takes about a second. > Looks like I was wrong. It appears that cgi.FieldStorage stores content in temp files only when uploaded parts have Content-length set. But browser doesn't set it and FieldStorage reads data with readline() and store

Re: Streaming uploads to temp files

2006-03-10 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: >Some number of megabytes per chunk (10, maybe). You are going to execute >a lot of loops and consequent data copying if you are doing multiple >passes per megabyte of data. > > This is the whole point -- to make it in small chunks (but not very small) to conserve mem

Re: Streaming uploads to temp files

2006-03-10 Thread Malcolm Tredinnick
Hi Ivan, Some initial thoughts... On Fri, 2006-03-10 at 11:43 +0300, Ivan Sagalaev wrote: > There is a ticket for making Django not to eat entire file upload in > memory http://code.djangoproject.com/ticket/1484 > > I have it basically working using cgi.FieldStorage which stores POSTed > file

Streaming uploads to temp files

2006-03-10 Thread Ivan Sagalaev
There is a ticket for making Django not to eat entire file upload in memory http://code.djangoproject.com/ticket/1484 I have it basically working using cgi.FieldStorage which stores POSTed files in temp files. request.FILES items now are classes inherited from dict that have file['file'] retur