RE: [XHR2] Blobs, names and FormData

On 11 July 2011 10:53, Jonas Sicking wrote:
On Mon, Jul 11, 2011 at 10:12 AM, Adrian Bateman <adrianba@microsoft.com> wrote:
> > Some content management systems use the original filename by default
> > when storing files in document libraries. It's certainly a lesser use case
> > but seems like a relatively trivial change to the API. I don't see it as
> > sugar, since it's not possible to achieve this on the client in any other way.
> 
> I've proposed adding the following function to BlobBuilder:
> 
> interface BlobBuilder {
>   ...
>   File getFile(in DOMString name, [optional] in DOMString contentType)
>   ...
> };
> 
> This will let you accomplish the same thing in just 2 additional lines
> of javascript (one of which can be reused).

Well, yes, there are multiple ways of proposing a solution. My point was there is no easy way to do this without adding some functionality somewhere (I don't consider manually constructing a multi-part message a simple approach). I don't like the BlobBuilder solution because it adds the notion of needing to link the same underlying blob data to both a Blob and File, which suggests an extra level of abstraction in the implementation. I'm not sure what other use case there is for getFile and I prefer the more isolated simpler fix to FormData.

Received on Monday, 11 July 2011 18:00:49 UTC