Re: [XHR2] Blobs, names and FormData

2011/6/29 Anne van Kesteren <annevk@opera.com>

> On Wed, 29 Jun 2011 16:43:13 +0200, Alfonso Martínez de Lizarrondo <
> amla70@gmail.com> wrote:
>
>> Providing an automatic filename it's better than sending an empty one, but
>> it fails to address interaction with existing systems (some might refuse the
>> upload if it doesn't look like a correct file type, at the very least a
>> proper extension). The usual "solution" suggested/used when people create
>> samples or code using these features is to add extra headers to send the
>> desired filename, but that means that the server code has to be updated to
>> handle this behavior.
>>
>
> What is the extension for unknown arbitrary contents? Is it .bin? We could
> also name it "blob.blob" if that improves matters. It really does not matter
> much.
>
>
>
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.


> --
> Anne van Kesteren
> http://annevankesteren.nl/
>

Received on Wednesday, 29 June 2011 16:22:06 UTC