Thank you. Could you email it to me?
On Oct 2, 5:06 am, Maciek Sykulski <[email protected]> wrote:
> Hi Everyone, Hi Massimo,
>
> I was having fun time working with web2py and setting up multiple file
> upload in one form using
> jquery.MultiFile.js
> fromhttp://www.fyneworks.com/jquery/multiple-file-upload/
> when I encountered the following problem:
>
> When multiple files are uploaded in one form, they are send as a list
> of files.
> Such a list is captured properly by CherryPy, then,
> web2py loses information about these files while parsing variables to
> request.vars,
> because it parses all lists trying to access its elements' .value
> field.
>
> I wasn't able to make it work properly until applying the following
> patch to gluon/main.py:
>
> diff -u --exclude='*pyc' web2py/gluon/main.py gluon/main.py
> --- web2py/gluon/main.py 2009-08-17 15:21:17.000000000 +0200
> +++ gluon/main.py 2009-08-21 17:09:58.000000000 +0200
> @@ -346,7 +346,11 @@
> for key in keys:
> dpk = dpost[key]
> if isinstance(dpk, list):
> - value = [x.value for x in dpk]
> + #import pdb;pdb.set_trace()
> + if not dpk[0].filename:
> + value = [x.value for x in dpk]
> + else:
> + value = [x for x in dpk]
> elif not dpk.filename:
> value = dpk.value
> else:
>
> Should this patch be applied to the main tree, or maybe I'm missing
> some other problems here?
>
> Thanks!
> Maciek Sykulski
>
> PS: If someone's interested I've coded classes:
> class MultiSQLFORM(SQLFORM):
> class MultiCrud(Crud):
> ready to use with jquery.MultiFile.js that handle uploading multiple
> files to a database in a single form submission.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---