Massimo, just for my personal edification, why won't open(os.path.join(...,'wb').write(...read()) be suitable for writing large files? What's a large file, anyway?
On Jul 2, 8:27 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > No. For large files use this instead: > > def index(): > > form=FORM((INPUT(_type='file',_name='myfile'),INPUT(_type='submit')) > if form.accepts(request.vars,session): > > shutil.copyfileobj(form.myfile.file,open(os.path.join(request.folder,'static','filename.txt'),'wb')) > response.flash='uploaded' > return dict(form=form) > > On 2 Lug, 19:06, Phyo Arkar <phyo.arkarl...@gmail.com> wrote: > > > Thanks a lot! > > this code can also write Large Files right? > > > On Fri, Jul 2, 2010 at 11:48 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > def index(): > > > > form=FORM((INPUT(_type='file',_name='myfile'),INPUT(_type='submit')) > > > if form.accepts(request.vars,session): > > > > open(os.path.join(request.folder,'static','filename.txt'),'wb').write(form.myfile.file.read()) > > > response.flash='uploaded' > > > return dict(form=form) > > > > but you need to come up with a safe way to generate a 'filename.txt' > > > > On 2 Lug, 18:40, Phyo Arkar <phyo.arkarl...@gmail.com> wrote: > > > > Anyway to Upload directly to Static Folder (none SQLForm, none DB) > > > > And Serve file without streaming and going through Controller?