W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: File API Feedback

From: Arun Ranganathan <arun@mozilla.com>
Date: Tue, 28 Jul 2009 14:59:07 -0700
Message-ID: <4A6F74AB.1040403@mozilla.com>
To: Michael Nordman <michaeln@google.com>
CC: public-webapps@w3.org
Michael Nordman wrote:
> The BlobBuilder.append() method is central to the use-case I'm referring to.
> builder.append(string data that comprises the multipart/form-data header);
> builder.append(string data that comprises simple text part);
> builder.append(string data that comprises the start of a binary part);
> builder.append(fileBlob); // the file itself
> builder.append(string data that closes the binary part);
> // perhaps more binary and text parts
> builder.append(string data that closes the multipart/form-data);
> multipartBlob = builder.getAsBlob();
>
> httpRequest.send(multipartBlob);
>   
A previous message I sent [1] discusses what's being done today (e.g. 
w.r.t. xhr.sendAsBinary(file.getAsBinary()) ), but may be a bit 
misleading with respect to string concatenation and adding form headers 
(e.g. 'multipart/form-data') using getAsText.  Using getAsText (as 
currently specified) won't do anything meaningful to data that doesn't 
decode as the 'encoding' argument, and implementations are expected to 
make determinations about what format to use.  In particular, this can't 
really be used for binary data; it won't do the right thing for JPEGs. 

It's better to add binary getters that return FileData contents as 
strings (getAsBase64 or getAsBinary), on which string manipulations are 
possible.  Anne says that the send() method of XHR2[2] will work with 
FileData objects; if we evolve XHR for these kinds of data, that would 
better address these use cases.

-- A*
[1] http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/0305.html
[2] http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/0309.html
Received on Tuesday, 28 July 2009 21:59:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:33 GMT