W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: [XHR2] Blobs, names and FormData

From: Alfonso Martínez de Lizarrondo <amla70@gmail.com>
Date: Wed, 29 Jun 2011 18:34:58 +0200
Message-ID: <BANLkTimy7++tGfJW5bD2tHLeLKBxBRHP-A@mail.gmail.com>
To: Anne van Kesteren <annevk@opera.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Webapps WG <public-webapps@w3.org>
2011/6/29 Anne van Kesteren <annevk@opera.com>

> On Wed, 29 Jun 2011 18:21:39 +0200, Alfonso Martínez de Lizarrondo <
> amla70@gmail.com> wrote:
>
>> If a png screenshot (as provided by current Chrome in the paste event) is
>> sent to the server and saved as "blob.bin" or "blob.blob", I doubt that it
>> will be sent back to the client with the correct mime type and I don't know
>> why the browser should try to sniff those contents instead of providing a
>> correct hint while uploading the data to the server.
>>
>> I don't really know a realistic situation where a page can generate a Blob
>> and don't know what kind of contents it has. It can be some text, some html,
>> some picture, the new APIs will allow to create new types of contents that
>> previously were out of scope for javascript, but in any of those situations
>> the script will know what kind of data it's dealing with and what's the
>> commonly expected extension for that content. So sending it in "the
>> correct way" seems to me like a logical step, supporting the FormData is far
>> more
>> complex than just allowing to specify the filename so it would be a pity
>> to forget about this missing bit.
>>
>
> Are you suggesting the browser should perform sniffing and decide the
> extension based on that? What rules should it follow?
>
> http://tools.ietf.org/html/**draft-ietf-websec-mime-sniff<http://tools.ietf.org/html/draft-ietf-websec-mime-sniff>
>
> I'm not sure dragging all that complexity here is a good idea.
>
>
> 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)

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'm just requesting for a way to specify the filename (specifically the
extension is the important part) that will be sent to the server.



> --
> Anne van Kesteren
> http://annevankesteren.nl/
>
Received on Wednesday, 29 June 2011 16:35:25 GMT

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