When using rawinput you might not get list of files when you're
uploading only one, then you have to ensure files to be list.

files = web.webapi.rawinput().get( "upload" )

if not isinstance(files, list):
    files = [files]
    for f in files:
        # save every file





On Sep 13, 12:12 pm, Anand Chitipothu <[email protected]> wrote:
> 2011/9/13 Ben Hayden <[email protected]>:
>
> > Hey guys,
> > I've got JavaScript for multiple file uploads, and all the file name
> > attributes are labeled 'name'.
> > <div id="addAttachments_wrapper">
> >     <input type="file" name="upload">
> >     <input type="file" name="upload">
> > </div>
>
> > On the python side, I can't get a list of 'upload' field storage objects
> > with both the filename & value.
> > With this:
> > query_data = web.input(upload=[])
>
> > I can get a list with string file upload values, but no filename.
> > With this:
> > query_data = web.input(upload={})
>
> > I only get the last upload FieldStorage with filename & value, so I lose the
> > first upload.
> > Any ideas on how I can get both uploads & perserve both file names?
>
> Try using:
>
> web.webapi.rawinput().get("upload")
>
> The input function takes the return value of rawinput(..) and converts
> to appropriate form. By calling the rawinput function directly you get
> data without any conversion.
>
> Anand

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to