Hi,
I'm collecting dataset files from users. There can be several versions as
problems with the files get fixed and I want to organise the uploaded files
by their common dataset id. So in my controller I do this:
# set the upload directory locally
upload_dir = os.path.join(request.folder, 'uploads', 'datasets', str(
new_ds_id))
db.datasets.file.uploadfolder = upload_dir
# Setup the form
form = SQLFORM(db.datasets,
record = record,
fields=['project_id', 'file'],
showid=False,
deletable=False,
button='Upload')
That works really nicely and I just have to remember to use that path where
I need to find the file within the code.
However, I can't work out how to get the download controller to work with
the folder structure. For example, I'm currently using SQLFORM.grid to
provide a table of uploaded datasets, and when users click through to view
a particular record then they get the nice automatically generated file
download link. Unfortunately, that has no idea that there is the extra
component in the path, so it doesn't work.
I've had a look at the source for response.download, heading into
field.retrieve and it looks like I should be able to set a custom_retrieve,
but I can't find example usage.
Any suggestions?
Many thanks,
David
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.