Did you check the contents of request.vars.attachment when you upload
multiple files at once? It should be a list already.

attachment[] is not a python syntax which you may have noticed from the
SyntaxError exception.

Something is wrong in your code (second exception), not related to the
upload issue.


On Wed, Jun 12, 2013 at 3:01 PM, Domagoj Kovač <[email protected]>wrote:

> Hi,
>
> I have a question. I want to enable multiple files upload. I will not be
> using any jQuery/ajax script. I am using HTML5 multiple attribute on my
> input field, and then. Html 5 File API just for displaying files below my
> form.
>
>     $(".upload").change(function(evt) {
>         var button = $(this);
>         var files = evt.target.files;
>
>         button.next("ul.new").remove();
>
>         var output = [];
>         for (var i = 0, f; f = files[i]; i++) {
>             output.push('<li><strong>', f.name, '</li>');
>         }
>
>         button.after('<ul class="files new">' + output.join('') + '</ul>');
>     })
>
> In my form i want to have a field names attachment[] instead of
> attachment, so i can receive multiple files. When i add [] to my file input
> name i receive an error:
> <type 'exceptions.SyntaxError'> invalid table or field name: attachment[]
> If i try to upload multiple files without changing the name, i receive an
> error:
> <type 'exceptions.UnboundLocalError'> local variable 'source_file'
> referenced before assignment
> How could i do this?
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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.


Reply via email to