On 11 Gen, 12:05, Łukasz Rekucki <lreku...@gmail.com> wrote: > On 11 January 2011 11:28, Jani Tiainen <rede...@gmail.com> wrote: > > > > > > > On Monday 10 January 2011 16:05:13 Mauro wrote: > >> On 23 Dic 2010, 23:12, Paul Osman <p...@eval.ca> wrote: > >> > On Thu, Dec 23, 2010 at 9:39 AM, Mauro <mdrio1...@gmail.com> wrote: > >> > > Hello, > >> > > is it possible touploadfiles viaajax? > > >> > > I would like touploadmultiple files in my application but i have the > >> > > following exception: > > >> > > MultiPartParserError: Invalid boundary in multipart: None > > >> > > I'm using django 1.1. > >> > > Theajaxrequest has the content type header set as mulitpart/form- > >> > > data > > >> > This was recently posted to the Mozilla Webdev blog. Might help you: > > >> >http://blog.mozilla.com/webdev/2010/09/17/django-and-ajax-image-uploads/ > > >> > -Paul > > >> Hi, thanks for replying, but would like to choose the files at once > >> and thenuploadthem one by one (without flash, only html). Using an > >>ajaxrequest, django returns the MultiParseError. Moreover i try to > >> user request._post_raw_data, but i would like to send also some other > >> informations together with the files, and i do not to retrieve them > >> from raw_data, > >> Any other idea? > > > First at all this is not possible. It is not possible send files usingajax. > > Yes you can:http://www.w3.org/TR/XMLHttpRequest2/This only works > fully in Firefox 4 and Webkit browsers (last I tested). Firefox 3.6 > lacks the FormData object, but has an API to read files from > JavaScript, so you can form-encode the data yourself and use > xhr.send(). An almost complete implementation can be seen > here:http://code.google.com/p/jquery-html5-upload/. > > > > > But you can use ajaxy like approach. Common way is to create (invisible) > > iframe where you clone original form and just do normal post there. > > > When iframe loads you can post back response from server to your > > application. > > It's not fullyajaxbut as close as it can get without using flash. > > I call this HTML4 fallback. I have a whole jQuery plugin that > transparently uses an IFrame if the user's browser doesn't have any of > required HTML5 capabilities. It lets youuploadmultiply files with > additional POST data (e.g. file description, tags). Sadly, I can't > open-source it just yet. > > -- > Łukasz Rekucki
Thanks a lot! It seems very interesting! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.