You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by silent <si...@gmail.com> on 2011/08/12 04:47:14 UTC

[libapreq] unknown content-type: `application/octet-stream'

hi, list

I'm using a javascript ajax file uploader, but get this error with mod_perl1.

the js code is like:

        var xhr = new XMLHttpRequest();

        xhr.open("POST", queryString, true);
        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        xhr.send(file);

Re: [libapreq] unknown content-type: `application/octet-stream'

Posted by Salvador Ortiz Garcia <so...@msg.com.mx>.
On 08/11/2011 09:47 PM, silent wrote:
> hi, list
>
> I'm using a javascript ajax file uploader, but get this error with mod_perl1.
>
> the js code is like:
>
>          var xhr = new XMLHttpRequest();
>
>          xhr.open("POST", queryString, true);
>          xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
>          xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
>          xhr.setRequestHeader("Content-Type", "application/octet-stream");
>          xhr.send(file);
libapreq can only parse 'application/x-www-form-urlencoded' or 
'multipart/form-data'.

So if you want use Apache::Request (libapreq) and handle file uploads, 
you should use a Content-Type of 'multipart/form-data'.

Or write your own request parser.

Regards.

Salvador Ortiz.