I am using Dojo to upload multiple files to the server at once. It sends a POST request to my Web.py app, submitting the files under the attribute name 'uploadedfiles'.
I try to catch and return these files with the following code:
def POST(self): x = web.input() return x.uploadedfiles
Works great with one file, but with 2 or more it returns only the last file.
I Read the Docs; says web.input uses a dict-like object, so the behavior above makes sense.
So reading up on things, I try: def POST(self): x = web.input(uploadedfiles=[]) return x.uploadedfiles
Cool! Now it returns a list with both files! But it's just the file itself. It's not a storage object like it would be if there was just one file.
My question is:
Is there a way to return a list of storage objects from web.input()
x is a storage object that web.input() returns. file or list of files is value of x.uploadedfiles. storage object is not for storing files, its basically a dict what values you can get via dot syntax.
On Friday, October 19, 2012 3:22:31 AM UTC+4, Jason Macgowan wrote:
> I am using Dojo to upload multiple files to the server at once. It sends > a POST request to my Web.py app, submitting the files under the attribute > name 'uploadedfiles'.
> I try to catch and return these files with the following code:
> def POST(self): > x = web.input() > return x.uploadedfiles
> Works great with one file, but with 2 or more it returns only the last > file.
> I Read the Docs; says web.input uses a dict-like object, so the behavior > above makes sense.
> So reading up on things, I try: > def POST(self): > x = web.input(uploadedfiles=[]) > return x.uploadedfiles
> Cool! Now it returns a list with both files! But it's just the file > itself. It's not a storage object like it would be if there was just one > file.
> My question is:
> Is there a way to return a list of storage objects from web.input()
On Fri, Oct 19, 2012 at 3:13 AM, Andrey Kuzmin <Andre...@gmail.com> wrote:
> x is a storage object that web.input() returns. file or list of files is
> value of x.uploadedfiles. storage object is not for storing files, its
> basically a dict what values you can get via dot syntax.
> On Friday, October 19, 2012 3:22:31 AM UTC+4, Jason Macgowan wrote:
>> I am using Dojo to upload multiple files to the server at once. It sends
>> a POST request to my Web.py app, submitting the files under the attribute
>> name 'uploadedfiles'.
>> I try to catch and return these files with the following code:
>> def POST(self):
>> x = web.input()
>> return x.uploadedfiles
>> Works great with one file, but with 2 or more it returns only the last
>> file.
>> I Read the Docs; says web.input uses a dict-like object, so the behavior
>> above makes sense.
>> So reading up on things, I try:
>> def POST(self):
>> x = web.input(uploadedfiles=[])
>> return x.uploadedfiles
>> Cool! Now it returns a list with both files! But it's just the file
>> itself. It's not a storage object like it would be if there was just one
>> file.
>> My question is:
>> Is there a way to return a list of storage objects from web.input()
> To post to this group, send email to webpy@googlegroups.com.
> To unsubscribe from this group, send email to
> webpy+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
On Fri, Oct 19, 2012 at 8:37 AM, Jason Macgowan <jasonmacgo...@gmail.com> wrote:
> Right, but the issue is that my uploaded file list is just a list with
> strings. I need a way to access both of the uploaded files
> On Fri, Oct 19, 2012 at 3:13 AM, Andrey Kuzmin <Andre...@gmail.com> wrote:
>> x is a storage object that web.input() returns. file or list of files is
>> value of x.uploadedfiles. storage object is not for storing files, its
>> basically a dict what values you can get via dot syntax.
>> On Friday, October 19, 2012 3:22:31 AM UTC+4, Jason Macgowan wrote:
>>> I am using Dojo to upload multiple files to the server at once. It sends
>>> a POST request to my Web.py app, submitting the files under the attribute
>>> name 'uploadedfiles'.
>>> I try to catch and return these files with the following code:
>>> def POST(self):
>>> x = web.input()
>>> return x.uploadedfiles
>>> Works great with one file, but with 2 or more it returns only the last
>>> file.
>>> I Read the Docs; says web.input uses a dict-like object, so the behavior
>>> above makes sense.
>>> So reading up on things, I try:
>>> def POST(self):
>>> x = web.input(uploadedfiles=[])
>>> return x.uploadedfiles
>>> Cool! Now it returns a list with both files! But it's just the file
>>> itself. It's not a storage object like it would be if there was just one
>>> file.
>>> My question is:
>>> Is there a way to return a list of storage objects from web.input()
>> To post to this group, send email to webpy@googlegroups.com.
>> To unsubscribe from this group, send email to
>> webpy+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/webpy?hl=en.
> This is bad markup, yes, but it's only to demonstrate the content of > the POST request that Dojo's mutli uploader creates.
> My question is, how do I access the files from this POST request?
> web.input(uploadedfile={}) will only give me the last file > web.input(uploadedfile=[]) will only give me a list of strings from the > files
> I'm stumped, so any help is appreciated.
> On Fri, Oct 19, 2012 at 8:37 AM, Jason Macgowan <jasonm...@gmail.com<javascript:>> > wrote: > > Right, but the issue is that my uploaded file list is just a list with > > strings. I need a way to access both of the uploaded files
> > On Fri, Oct 19, 2012 at 3:13 AM, Andrey Kuzmin <Andr...@gmail.com<javascript:>> > wrote: > >> x is a storage object that web.input() returns. file or list of files > is > >> value of x.uploadedfiles. storage object is not for storing files, its > >> basically a dict what values you can get via dot syntax.
> >> On Friday, October 19, 2012 3:22:31 AM UTC+4, Jason Macgowan wrote:
> >>> I am using Dojo to upload multiple files to the server at once. It > sends > >>> a POST request to my Web.py app, submitting the files under the > attribute > >>> name 'uploadedfiles'.
> >>> I try to catch and return these files with the following code:
> >>> Works great with one file, but with 2 or more it returns only the last > >>> file.
> >>> I Read the Docs; says web.input uses a dict-like object, so the > behavior > >>> above makes sense.
> >>> So reading up on things, I try: > >>> def POST(self): > >>> x = web.input(uploadedfiles=[]) > >>> return x.uploadedfiles
> >>> Cool! Now it returns a list with both files! But it's just the file > >>> itself. It's not a storage object like it would be if there was just > one > >>> file.
> >>> My question is:
> >>> Is there a way to return a list of storage objects from web.input()
> >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "web.py" group. > >> To view this discussion on the web visit > >> https://groups.google.com/d/msg/webpy/-/8S7bccaJ9ZsJ.
> >> To post to this group, send email to we...@googlegroups.com<javascript:>.
> >> To unsubscribe from this group, send email to > >> webpy+un...@googlegroups.com <javascript:>. > >> For more options, visit this group at > >> http://groups.google.com/group/webpy?hl=en.
>> This is bad markup, yes, but it's only to demonstrate the content of
>> the POST request that Dojo's mutli uploader creates.
>> My question is, how do I access the files from this POST request?
>> web.input(uploadedfile={}) will only give me the last file
>> web.input(uploadedfile=[]) will only give me a list of strings from the
>> files
>> I'm stumped, so any help is appreciated.
>> On Fri, Oct 19, 2012 at 8:37 AM, Jason Macgowan <jasonm...@gmail.com>
>> wrote:
>> > Right, but the issue is that my uploaded file list is just a list with
>> > strings. I need a way to access both of the uploaded files
>> > On Fri, Oct 19, 2012 at 3:13 AM, Andrey Kuzmin <Andr...@gmail.com>
>> > wrote:
>> >> x is a storage object that web.input() returns. file or list of files
>> >> is
>> >> value of x.uploadedfiles. storage object is not for storing files, its
>> >> basically a dict what values you can get via dot syntax.
>> >> On Friday, October 19, 2012 3:22:31 AM UTC+4, Jason Macgowan wrote:
>> >>> I am using Dojo to upload multiple files to the server at once. It
>> >>> sends
>> >>> a POST request to my Web.py app, submitting the files under the
>> >>> attribute
>> >>> name 'uploadedfiles'.
>> >>> I try to catch and return these files with the following code:
>> >>> Works great with one file, but with 2 or more it returns only the last
>> >>> file.
>> >>> I Read the Docs; says web.input uses a dict-like object, so the
>> >>> behavior
>> >>> above makes sense.
>> >>> So reading up on things, I try:
>> >>> def POST(self):
>> >>> x = web.input(uploadedfiles=[])
>> >>> return x.uploadedfiles
>> >>> Cool! Now it returns a list with both files! But it's just the file
>> >>> itself. It's not a storage object like it would be if there was just
>> >>> one
>> >>> file.
>> >>> My question is:
>> >>> Is there a way to return a list of storage objects from web.input()
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "web.py" group.
>> >> To view this discussion on the web visit
>> >> https://groups.google.com/d/msg/webpy/-/8S7bccaJ9ZsJ.
>> >> To post to this group, send email to we...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> webpy+un...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/webpy?hl=en.
> To post to this group, send email to webpy@googlegroups.com.
> To unsubscribe from this group, send email to
> webpy+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.