On Wed, May 15, 2013 at 1:09 PM, Larry Martell <larry.mart...@gmail.com>wrote:

> On Wed, May 15, 2013 at 9:51 AM, Bill Freeman <ke1g...@gmail.com> wrote:
> > If you are saying that you have other inputs in the form, and that you
> are
> > not getting them in request.POST, you may not be specifying the correct
> > enctype attribute in the form tag (should be multipart/form-data).
>
> That's the form tag I have.
>

The form looks good to me (which doesn't mean that it is).  I'd be breaking
out pdb at this point to see what the browser is actually sending, and why
it doesn't get collected into request.POST.

>
> > If there are other values you want to send that are not form inputs, one
> > option is to url encode them and add them as query parameters to the form
> > tag's action attribute, and they will appear in request.GET, even though
> you
> > are doing a POST.
>
> How would I do that? I googled for it, but did not find any examples.
>

See, for example, encodeURI() at
http://www.w3schools.com/jsref/jsref_encodeuri.asp
If any of your arguments need to contain any of the special characters
mentioned as not encoded, encode those arguments first with
encodeURIComponent(), linked to from the w3schools article.

>
> Thanks!
>
> >
> > You should do a POST to reliably upload a file, since various things in
> the
> > chain may have restrictions on the length or content of URL path strings.
> >
> > Bill
> >
> >
> > On Wed, May 15, 2013 at 11:19 AM, 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.
> >>
> >> --
> >> 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.
> >>
> >>
> >
> > --
> > 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.
> >
> >
>
> --
> 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.
>
>
>

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