Re: Proposal for sending multiple files via XMLHttpRequest.send()

2009/9/10 Jian Li <jianli@chromium.org>:
> There has already been a discussion on extending XMLHttpRequest.send() to
> take a File object. Could we also consider enhancing it further to support
> sending multiple files, like a FileList from the drag and drop.
> We could make XMLHttpRequest.send() take a FileList object and let the
> browser add multipart boundary separators automatically..
> Or, the other simpler way, thanks to Darin's suggestion, is to
> extend XMLHttpRequest.send() to take an array of items. Each of item could
> be either a string or a file reference strictly. The web application is
> responsible to generate the multipart enevelop like the following:
>     var payload = new Array;
>     payload.push(header1);
>     payload.push(file1);
>     payload.push(footer1);
>     ...
>     xhr.send(payload);
> How do you guys think about these approaches?
> Thanks,
> Jian
>

How is supposed the web application to detect that the browser
supports this feature?

And between the two approaches, the first one is simpler, but the
second one allows to send the files one each time and add other form
data in the request.

Received on Friday, 11 September 2009 14:32:32 UTC