On Wed, May 15, 2013 at 9:47 AM, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, May 15, 2013 at 4:19 PM, Larry Martell <larry.mart...@gmail.com> 
> wrote:
>> On Wed, May 15, 2013 at 9:04 AM, Tom Evans <tevans...@googlemail.com> wrote:
>>> On Wed, May 15, 2013 at 3:38 PM, Larry Martell <larry.mart...@gmail.com> 
>>> wrote:
>>>> I have a form with an upload files button. The form is POSTed so that
>>>> I can get the file list in HttpRequest.FILES (which is only populated
>>>> for a POST). But I have other parameters I want to pass back as well
>>>> (which I cannot do in POST). So I changed it to a GET, but now the
>>>> list of files is a string, and not a list of file objects. Is there a
>>>> way I can get a list of file objects and other parameters sent back at
>>>> the same time?
>>>>
>>>
>>> Why can you not get the additional parameters in a POST request, this
>>> is unclear (and would be the normal way of handling this).
>>
>> Yes, it's unclear to me as well. ;-) The other parameters are not sent
>> back on POST. The URL doesn't have them and they are not in the
>> request.META['QUERY_STRING']. So I added onsubmit to my form that
>> calls a javascript function that puts the parameters in the URL and
>> that seems to automagically change it to a GET and HttpRequest.FILES
>> is no longer populated.
>>
>
> In a POST request the data is url encoded and sent as the request body
> - along with any file data. You don't need to do anything magic with
> JS to make this work.
>
> Can you show some HTML and python of how you are presenting and
> processing the form?

A bit more info on this. I went back to trying to get the form to
return the parameters as it should. I realized I was not calling
form.is_valid(). I added that, and found it was returning false
because it said all 4 of the char fields were not being provided even
though they are. Looking at what the browser is sending, indeed it's
sending just the one file field. It's like the fields in my template
are not being linked up with the fields in the form.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to