Ok, thanks. I would be great if upload would be mapped to list.
On Wednesday, June 26, 2013 12:34:38 PM UTC+2, Niphlod wrote:
>
> just handle it outside web2py. Building a form with SQLFORM changing the
> widget at your will is not going to work.
> it's like you asking for a checkbox field but using a textarea to do
> it.....it doesn't make any sense...
>
> Maybe we'll have in the future an upload mapped to a list:string (sounds
> about right) and something that processes that accordingly, but out of the
> box right now you just can't use SQLFORM facilities for this expecting it
> to work.....
>
> AFAIK cgi.FieldStorage can't process out of the box HTML5's multiple input
> files.
>
> On Wednesday, June 26, 2013 12:24:17 PM UTC+2, Domagoj Kovač wrote:
>>
>> Hi Niphlod,
>>
>> I reviewed your code, in your test method you have:
>> form = SQLFORM.factory(
>> Field('an_integer', 'integer'),
>> Field('upload_1', 'upload', uploadfolder=upf),
>> Field('upload_2', 'upload', uploadfolder=upf),
>> table_name='an_entry'
>> )
>> i don't want two field, i only want one field.
>> form = SQLFORM.factory(
>> Field('an_integer', 'integer'),
>> Field('attachment', 'upload', uploadfolder=upf),
>> table_name='an_entry'
>> )
>> and in my view
>> {{form.custom.widget["attachment"]['_multiple'] = "multiple"}}
>>
>> Now this attachment has multiple attribute, multiple is HTML 5 attribute
>> and it enables me to select more than one file.
>>
>> When i add multiple attribute and select more than one file, web2py gives
>> me an error:
>> <type 'exceptions.UnboundLocalError'> local variable 'source_file'
>> referenced before assignment
>>
>> This is the code listing with the problem:
>>
>> (source_file, original_filename) = (f.file, f.filename)
>> elif isinstance(f, (str, unicode)):
>> ### do not know why this happens, it should not
>> (source_file, original_filename) = \
>> (cStringIO.StringIO(f), 'file.txt')
>>
>> newfilename = field.store(source_file, original_filename,
>> field.uploadfolder)
>> # this line was for backward compatibility but problematic
>> # self.vars['%s_newfilename' % fieldname] = newfilename
>> fields[fieldname] = newfilename
>>
>>
--
---
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/groups/opt_out.