Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 23, 2010 14:54:23

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


Hello,
is it possible to upload files via ajax?

I would like to upload multiple files in my application but i have the
following exception:

MultiPartParserError: Invalid boundary in multipart: None

I'm using django 1.1.
The ajax request has the content type header set as mulitpart/form-
data

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 23, 2010 17:42:59

r.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


http://www.swfupload.org/is all You need :)

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 23, 2010 22:37:28

Paul O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


On Thu, Dec 23, 2010 at 9:39 AM, Mauro <mdrio1...@gmail.com> wrote:

> Hello,
> is it possible to upload files via ajax?
>
> I would like to upload multiple files in my application but i have the
> following exception:
>
> MultiPartParserError: Invalid boundary in multipart: None
>
> I'm using django 1.1.
> The ajax request 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

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 10, 2011 14:05:20

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


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 to upload files via ajax?
>
> > I would like to upload multiple files in my application but i have the
> > following exception:
>
> > MultiPartParserError: Invalid boundary in multipart: None
>
> > I'm using django 1.1.
> > The ajax request 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 then upload them one by one (without flash, only html). Using an
ajax request, 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?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 11, 2011 11:06:20

Łukasz R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


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 to upload files via ajax?
>> > >
>> > > I would like to upload multiple files in my application but i have the
>> > > following exception:
>> > >
>> > > MultiPartParserError: Invalid boundary in multipart: None
>> > >
>> > > I'm using django 1.1.
>> > > The ajax request 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 then upload them one by one (without flash, only html).  Using an
>> ajax request, 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 using ajax.

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 fully ajax but 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 you upload multiply files with
additional POST data (e.g. file description, tags). Sadly, I can't
open-source it just yet.

--
Łukasz Rekucki

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Jan. 11, 2011 11:15:41

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


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/Thisonly 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Jan. 12, 2011 10:03:45

Mauro D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


On Tue, Jan 11, 2011 at 1:12 PM, Jani Tiainen <rede...@gmail.com> wrote:

>
>http://valums.com/ajax-upload/>
> There is one standalone version how to do it pretty much browser
> independently.
>
>
>
> --
>
> Jani Tiainen
>

It seems to be what i am looking for, thanks!
>
>
>
>
> --
> 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.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 Jan. 12, 2011 12:58:55

Eugene M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


I'm using Ploploadhttp://plupload.comit's very nice!!

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 Jan. 12, 2011 13:59:34

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

upload files via ajax


On 2011-01-11, at 13:12 , Jani Tiainen wrote:
>
> I think Dojotoolkit and ExtJS both have nice mechanisms to do this ootb so no
> need to reinvent the wheel. I've never been fan of jquery so I don't know is
> there something for them (or for other similiar pure js frameworks)
For jquery, the `jquery-forms` plugin handles that, though it's not entirely
transparent (I don't expect it to be on Dojo or Ext) when it has to rely on
iframes, as it's e.g. not possible to set headers on iframe requests.

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 16th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support