With regards to storing the file, can you still use regex to validate
the filename if you choose to utilize this direct upload method?  I'm
working on a project where a requirement is to store the files as-is
on the filesystem as they will be utilized by other programs.

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,'stati 
> c','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?

Reply via email to