On Nov 19, 2009, at 9:36 AM, Vlad Seryakov wrote: > Yes, regular form parser uses mmap, so for huge files it is not good > I use 1-2GB file pretty easily with the spooler. > In the script, just check if the file is spooled > > set tmpfile [ns_conn contentfile] > if { $tmpfile != "" } { > # Rename to keep it from being deleted on session exit > file rename $tmpfile $tmpfile.mpg > > # Call offline parser > set form [ns_set create] > ns_parseformfile $tmpfile $form [ns_set iget [ns_conn headers] content-type] > }
Thank you Vlad, for this source code, which led me in the right direction. This all works now and my nsd process never goes about 50mb in handling a 2gb zip file upload. In case anyone else has to ever deal with this, here were the issues with handling a large file upload with the spooler: A) the spooler wasn't being used, rather the old form handler was, so I changed the config.tcl file to: ns_param maxinput 3000000000 ns_param maxupload 1024 to force the spooler to be almost always used. B) form vars are not parsed when the spooler is used, so ns_queryget doesn't work, and instead something like this needs to be used to get to the form vars: set form [ns_set create] ns_parseformfile $tmpfile $form [ns_set iget [ns_conn headers] content-type] array set formdata [ns_set array $form] ---- Vlad, in the code sample you gave above, I don't think you want to do this: > # Rename to keep it from being deleted on session exit > file rename $tmpfile $tmpfile.mpg because if you do that, the ns_parseformfile command immediately afterward fails because the temp file is no longer there. Your code sample doesn't work. Here is the code I finally settled on, which works great. ###################### #### NAVISERVER SPOOLER UPLOAD HANDLER CODE set tmpfile [ns_conn contentfile] if { $tmpfile == "" } { ns_adp_puts {Something is wrong.} return } set form [ns_set create] ns_parseformfile $tmpfile $form [ns_set iget [ns_conn headers] content-type] array set formdata [ns_set array $form] puts "array: [array get formdata]" # this code fills in the variables I need rather than using ns_queryget set inemail $formdata(email) set inpw $formdata(pw) set desc $formdata(desc) ###################### ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel