Thanks again for doing this. I'll have to grab the latest trunk and
check it out. Will let you know.
One other thing, please. I emailed you an example where the input is a
field of type text. Once uploaded, the form.vars.text_in field is
written to a file in the "somewhere" folder. The filename of this file
was then inserted into the db.table.field.filename, where Field
('filename','upload'). When accessing this field with the download
function, however, the action failed. Is there some special method
required to do this -- read text in, write to a file, and make it
behave exactly as if the file had been uploaded using a field of type
upload?
On Sep 16, 11:46 pm, mdipierro <[email protected]> wrote:
> On Sep 16, 10:26 pm, weheh <[email protected]> wrote:> Very cool,
> Massimo. Thank you for your quick response! But ...
>
> > - Shouldn't that be os.path.join?
>
> yes, sorry for the typo
>
> > - Should I interpret your message as meaning that this will also work
> > with the standard download function -- the one that does a "return
> > response.download(request,db)"?
>
> that should work. Please give it a try and let me know.
>
> > - Can the db.table.field.uploadfolder be any place on the file system,
> > even places outside of web2py?
>
> yes.
>
>
>
> > On Sep 16, 10:29 pm, mdipierro <[email protected]> wrote:
>
> > > Ok. try this:
>
> > > db.table.field.uploadfolder=od.path.join(request.folder,"uploads/
> > > somewhere")
>
> > > reuires trunk. folder somewhere must exist.
>
> > > On Sep 16, 7:24 pm, Richard <[email protected]> wrote:
>
> > > > currently I save uploaded files to an external hard drive, and to
> > > > avoid additional I/O operations I use uploadfield=False. Then I save
> > > > the file with:
>
> > > > Field('model', type='upload', uploadfield=False, requires=IS_NOT_EMPTY
> > > > ())
> > > > ...
> > > > gluon.fileutils.copystream(request.vars.model.file, open
> > > > (model_filename, 'wb'), int(request.env.content_length))
>
> > > > Richard
>
> > > > On Sep 17, 7:29 am, mdipierro <[email protected]> wrote:
>
> > > > > Currently the only way to achieve this is:
> > > > > 1) move the file after has been uploaded
> > > > > 2) write your own download controller so that file can be retrieved.
>
> > > > > On Sep 16, 3:52 pm, weheh <[email protected]> wrote:
>
> > > > > > Has anyone successfully been able to store and retrieve uploaded
> > > > > > files
> > > > > > in a place other than applications/myapp/uploads? A subdirectory
> > > > > > under
> > > > > > uploads is OK. I want to store user files in applications/myapp/
> > > > > > uploads/userid/file.jpg or some variant of that, and then enable
> > > > > > users
> > > > > > to also download their files. I believe that the download function
> > > > > > will need to be modified to accomplish this, but it's not clear to
> > > > > > me
> > > > > > how to do it.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---