Upon submission of the form, you should find the file itself in 
request.vars.f_photo.file (and the filename in 
request.vars.f_photo.filename).

Anthony

On Thursday, March 22, 2012 9:11:10 AM UTC-4, LeMogwaï wrote:
>
> Greetings,
>
> I'm starting with web2py and it seems to be the right tool I need for my 
> project.
>
> My point is to upload a zip file to update or fill in a database (several 
> tables) including pictures.
> This will be a feature of my application and (auth) users will be allowed 
> to use this feature.
>
> Here are the steps:
> - show a form with a file-type field (done)
> - get the 20MB+ compressed file (zip or other) somewhere *
> - uncompress it (or access the files on the fly, I'll see)
> - get the CSV, check them and update the corresponding tables ...
> - ... transforming the image path field contents to a web2py upload-type 
> field *
> - get the pictures and put them to the upload directory with a web2py 
> generated name *
> - display ok or error on success/failure
>
> The * steps are the ones for which I need your help. I will manage the 
> other ones (uncompress, check...).
>
> Code snippets:
>
> db.define_table('t_product',
>     Field('f_reference', type='string', notnull=True),
>     Field('f_photo', type='upload'),
>     Field('f_description_multi', type='string'),
>     [...]
>
> Compressed file contents:
> - product.csv
> - others.csv
> - images/product 0001.jpg
> - images/product 0002.jpg
> - images/others 0005.jpg
> [...]
>
> the csv contents:
> "023693240","file:///p/a/t/h/images/product%200001.jpg","bla bla bla",[...]
>
> Till there, I've tried to get the uploaded file, but did not manage to 
> find it if it is not "stored" into an upload field, and I don't need that.
>
> Yhank you for any help.
>
> Le Mogwaï
>

Reply via email to