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

RE: [XHR2] Blobs, names and FormData

From: Adrian Bateman <adrianba@microsoft.com>
Date: Thu, 7 Jul 2011 01:00:55 +0000
To: Julian Reschke <julian.reschke@gmx.de>, Alfonso Martínez de Lizarrondo <amla70@gmail.com>
CC: Anne van Kesteren <annevk@opera.com>, Jonas Sicking <jonas@sicking.cc>, Webapps WG <public-webapps@w3.org>
Message-ID: <104E6B5B6535E849970CDFBB1C5216EB434F0847@TK5EX14MBXC136.redmond.corp.microsoft.com>
Just catching up with this thread. We ran into the same problem last week while
investigating FormData and XHR. Since FormData is designed to allow XHR to interact
with existing form end-points that usually required a navigation, we've found that
few of them have been tested with empty filenames.

On Wednesday, June 29, 2011 9:35 AM, Alfonso Martínez de Lizarrondo wrote:
> All I want is a way for the web page to state that when a Blob is used in
> a FormData object it should be send to the server with a proposed filename.
> No sniffing. No guessing. It's up to the script to suggest a correct
> filename (if it wants), or use whatever is the default filename used by the
> browser (Blob23g22g3024j23g209gj3g and the like, extensionless)
>
> My first simple approach was:
> formdata.append("elementName", blob, "picture.png");
>
> Jonas has suggested instead
> blobbuilder.getFile("picture.png")
>
> I don't mind one way or another, or something else you think it's better.

I was about to send a similar proposal. We'd prefer to add an optional argument
to append that specifies the filename. This is the smallest change to
implementations and doesn't require developers to understand the BlobBuilder in
order to use FormData. Having to create another reference to a Blob and probably
deal with managing a File and Blob both pointing to the same data seems
unnecessarily involved when all we want is to get the filename into the FormData
object.


On Thursday, June 30, 2011 12:28 AM, Julian Reschke wrote:
> On 2011-06-29 18:34, Alfonso Martínez de Lizarrondo wrote:
> > ...
> > No.
> >
> > All I want is a way for the web page to state that when a Blob is used
> > in a FormData object it should be send to the server with a proposed
> > filename. No sniffing. No guessing. It's up to the script to suggest a
> > correct filename (if it wants), or use whatever is the default
> > filename used by the browser (Blob23g22g3024j23g209gj3g and the like,
> > extensionless) ...
> 
> In which case there should also be a way to send the actual media type,
> no?

Yes, the blob has a content type so the correct type can also be sent.
Received on Thursday, 7 July 2011 01:01:42 GMT

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