Login Register

xhrPost with contentType: "multipart/form-data" results in "Separation boundary was not specified" error

Trying to upload a file using xhrPost.
I have my form

<FORM name="add_form" id="add_form" enctype="multipart/form-data" method="post" onsubmit="return false;">
<INPUT type="file" name="myFile" id="myFile">
...
</FORM>

and my dojo code:

dojo.xhrPost({
        contentType: "multipart/form-data",
        url: "process.cfm",
        handleAs: "text",
        timeout: 3000,
        handle: AddEditCallback,
        form: "add_form"
});

If I don't put the contentType thing, I get an error saying that the content type cannot be application/x-www-form-urlencoded even if I have enctype="multipart/form-data" in my form tag

If I put the contentType, then I get the following error back from my cold fusion server:

JRun Servlet Error
500 Separation boundary was not specified

Any ideas anyone?

Thanks

dojo.xhr* methods cannot

dojo.xhr* methods cannot handle forms with a file input. Use dojo.io.iframe.send() instead. Do a dojo.require("dojo.io.iframe"), then replace the dojo.xhrPost() call with a dojo.io.iframe.send() call. You can use the same argument object you are passing to dojo.xhrPost() with dojo.io.iframe.send().

Thanks for the response... I

Thanks for the response...
Tried it and it worked like a charm (once I passed the form in the right format)