Hi all,

I am struggling a bit to get a HTML5 FormData object submitting with 
Prototype's Ajax.Request().

Because the form data needs to be submitted as multipart/form-data, I need 
to set the Content-Type to include the MIME boundary, otherwise the 
receiving end can't decode the multipart/form-data content.

I am doing something like this:

var d = new FormData();
d.append('name', $F('name'));
d.append('type', 'blah');
d.append('filecontent', $('file').files[0]);

new Ajax.Request('url', {
    method: 'post',
    //contentType: 'multipart/form-data', // need MIME boundary
    postBody: d,
    onSuccess: function(r) { }
});

If I leave out the contentType parameter, then the form gets submitted as 
application/x-www-form-urlencoded, but the content is in 
multipart/form-data so it is not possible to decode it.  If I set the 
contentType to multipart/form-data then the recipient complains that the 
MIME boundary is missing from the HTTP Content-Type header.

How can I get the contentType set to include the MIME boundary used by the 
HTML5 FormData object?

Many thanks,
Adam.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at https://groups.google.com/group/prototype-scriptaculous.
For more options, visit https://groups.google.com/d/optout.

Reply via email to