File transfer with Apache2::Upload and XMLHttpRequest
am 28.07.2010 12:26:12 von Michael Wichmann--Apple-Mail-1--789621525
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
I tried to switch from the 'common' way to send a file to the server, =
which is in my case:
a) define a form with an file-input-element:
b) define mod_perl code, that saves the file-data inside a handler, =
something like:
my $apr =3D Apache2::Request->new($r);
my $upload =3D $apr->upload('file');
....
That works fine as it is easy to work with $upload and save the data.
But I really can not figure out how to handle the XHR-Approach on the =
server-side because now, of cause, the 'file' param is missing.
The JS client side code is (where 'file' is a HTML5 File-Object):
var xhr =3D new XMLHttpRequest();
xhr.open("POST", url + "?filename=3D" + encodeURIComponent(file.name), =
true);
xhr.setRequestHeader("Content-Type", "multipart/form-data");
xhr.send(file);
Any idea how now the server side part has to look like now?
Thanks, Michael=
--Apple-Mail-1--789621525
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=us-ascii