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 <[email protected]> wrote:
> Thanks a lot!
> this code can also write Large Files right?
>
> On Fri, Jul 2, 2010 at 11:48 PM, mdipierro <[email protected]> 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 <[email protected]> wrote:
> > > Anyway to Upload directly to Static Folder (none SQLForm, none DB)
> > > And Serve file without streaming and going through Controller?