Re: [XHR2] Blobs, names and FormData

2011-09-25 Thread Anne van Kesteren
On Sun, 25 Sep 2011 03:22:40 +0200, Charles Pritchard ch...@jumis.com wrote: Are there any objections to adding a Blob serialization method to the FormData interface? I still maintain my objection, yes. It is too soon to make FormData more complicated. Are JavaScript libraries offering the

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Anne van Kesteren
On Tue, 30 Aug 2011 21:49:19 +0200, Charles Pritchard ch...@jumis.com wrote: Many services use form-urlencoded for form data, though not for files, and typically not for large strings. Google's Picasa uses multipart/related instead of multipart/form-data. I believe that Google App engine has

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Charles Pritchard
On 8/30/2011 11:03 PM, Anne van Kesteren wrote: On Tue, 30 Aug 2011 21:49:19 +0200, Charles Pritchard ch...@jumis.com wrote: Many services use form-urlencoded for form data, though not for files, and typically not for large strings. Google's Picasa uses multipart/related instead of

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Charles Pritchard
On 8/30/2011 7:11 PM, Jonas Sicking wrote: On Tue, Aug 30, 2011 at 5:59 PM, Charles Pritchardch...@jumis.com wrote: On 8/30/11 5:52 PM, Jonas Sicking wrote: On Tue, Aug 30, 2011 at 3:26 PM, Charles Pritchardch...@jumis.com wrote: On 8/24/2011 11:56 PM, Charles Pritchard wrote: On

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Jonas Sicking
On Wed, Aug 31, 2011 at 12:07 AM, Charles Pritchard ch...@jumis.com wrote: On 8/30/2011 7:11 PM, Jonas Sicking wrote: On Tue, Aug 30, 2011 at 5:59 PM, Charles Pritchardch...@jumis.com  wrote: On 8/30/11 5:52 PM, Jonas Sicking wrote: On Tue, Aug 30, 2011 at 3:26 PM, Charles

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Charles Pritchard
On 8/31/2011 10:19 AM, Glenn Maynard wrote: On Wed, Aug 31, 2011 at 12:48 PM, Jonas Sicking jo...@sicking.cc wrote: Simple case: var callback = function(blob) { xhr.send(blob); }; formData.toBlob(callback, 'multipart/form-data'); Several services require signed messages

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Jonas Sicking
On Wed, Aug 31, 2011 at 10:19 AM, Glenn Maynard gl...@zewt.org wrote: On Wed, Aug 31, 2011 at 12:48 PM, Jonas Sicking jo...@sicking.cc wrote: Simple case: var callback = function(blob) { xhr.send(blob); }; formData.toBlob(callback, 'multipart/form-data'); Several services require

Re: [XHR2] Blobs, names and FormData

2011-08-31 Thread Charles Pritchard
On 8/31/2011 10:57 AM, Jonas Sicking wrote: On Wed, Aug 31, 2011 at 10:19 AM, Glenn Maynardgl...@zewt.org wrote: On Wed, Aug 31, 2011 at 12:48 PM, Jonas Sickingjo...@sicking.cc wrote: Simple case: var callback = function(blob) { xhr.send(blob); }; formData.toBlob(callback,

Re: [XHR2] Blobs, names and FormData

2011-08-30 Thread Anne van Kesteren
On Wed, 24 Aug 2011 21:57:59 +0200, Charles Pritchard ch...@jumis.com wrote: On 8/24/2011 1:33 AM, Anne van Kesteren wrote: Examples of such services would be useful here. (That would still accept urlencoded files.) A URL encoded post; that it would use a blob as the source of one of the

Re: [XHR2] Blobs, names and FormData

2011-08-30 Thread Charles Pritchard
On 8/24/2011 11:56 PM, Charles Pritchard wrote: On 8/24/11 11:36 PM, Jonas Sicking wrote: On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchardch...@jumis.com wrote: Prpoposed: FormData output with the x-www-form-urlencoded mime type: formData.toUrlEncodedBlob(xhr.send) [Supplemental]

Re: [XHR2] Blobs, names and FormData

2011-08-30 Thread Jonas Sicking
On Tue, Aug 30, 2011 at 3:26 PM, Charles Pritchard ch...@jumis.com wrote: On 8/24/2011 11:56 PM, Charles Pritchard wrote: On 8/24/11 11:36 PM, Jonas Sicking wrote: On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchardch...@jumis.com  wrote: Prpoposed: FormData output with the

Re: [XHR2] Blobs, names and FormData

2011-08-30 Thread Charles Pritchard
On 8/30/11 5:52 PM, Jonas Sicking wrote: On Tue, Aug 30, 2011 at 3:26 PM, Charles Pritchardch...@jumis.com wrote: On 8/24/2011 11:56 PM, Charles Pritchard wrote: On 8/24/11 11:36 PM, Jonas Sicking wrote: On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchardch...@jumis.com

Re: [XHR2] Blobs, names and FormData

2011-08-25 Thread Jonas Sicking
On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchard ch...@jumis.com wrote: Prpoposed: FormData output with the x-www-form-urlencoded mime type: formData.toUrlEncodedBlob(xhr.send) If going down the blob path, these two would have the same end-result: formData.toMultipartBlob(xhr.send)

Re: [XHR2] Blobs, names and FormData

2011-08-25 Thread Charles Pritchard
On 8/24/11 11:36 PM, Jonas Sicking wrote: On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchardch...@jumis.com wrote: Prpoposed: FormData output with the x-www-form-urlencoded mime type: formData.toUrlEncodedBlob(xhr.send) If going down the blob path, these two would have the same

Re: [XHR2] Blobs, names and FormData

2011-08-24 Thread Charles Pritchard
On 8/24/2011 1:33 AM, Anne van Kesteren wrote: On Tue, 23 Aug 2011 20:44:15 +0200, Charles Pritchard ch...@jumis.com wrote: Is there any interest in supporting application/x-www-form-urlencoded ? It would of course lose any carried content types or file names from Blobs. urlencoding is

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Anne van Kesteren
On Tue, 23 Aug 2011 02:25:38 +0200, Jonas Sicking jo...@sicking.cc wrote: Given that this seems to be the way people prefer to do it, I'm fine with doing that for Gecko too. But we definitely would need to get FormData.append changed so that it supports the use case. So the current line for

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Alfonso Martínez de Lizarrondo
Julian Reschke also wanted to specify the mime type El 23/08/2011 09:53, Anne van Kesteren ann...@opera.com escribió: On Tue, 23 Aug 2011 02:25:38 +0200, Jonas Sicking jo...@sicking.cc wrote: Given that this seems to be the way people prefer to do it, I'm fine with doing that for Gecko too. But

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Jonas Sicking
2011/8/23 Alfonso Martínez de Lizarrondo aml...@gmail.com: Julian Reschke also wanted to specify the mime type Why? Keeping in mind that you can (and arguably should) already specify the mimetype when you create a blob. Both BlobBuilder.getBlob and Blob.slice lets you specify a mimetype. And

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Jonas Sicking
On Tue, Aug 23, 2011 at 12:53 AM, Anne van Kesteren ann...@opera.com wrote: On Tue, 23 Aug 2011 02:25:38 +0200, Jonas Sicking jo...@sicking.cc wrote: Given that this seems to be the way people prefer to do it, I'm fine with doing that for Gecko too. But we definitely would need to get

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Anne van Kesteren
On Tue, 23 Aug 2011 10:18:19 +0200, Jonas Sicking jo...@sicking.cc wrote: Yes. Where if the filename is excluded is left out it uses the File.name of the Blob (if the Blob is also a File), or blob (if the Blob is not a File). That leaves the question what to do if the filename is specified but

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Charles Pritchard
On 8/23/2011 3:08 AM, Anne van Kesteren wrote: On Tue, 23 Aug 2011 10:18:19 +0200, Jonas Sicking jo...@sicking.cc wrote: Yes. Where if the filename is excluded is left out it uses the File.name of the Blob (if the Blob is also a File), or blob (if the Blob is not a File). That leaves the

Re: [XHR2] Blobs, names and FormData

2011-08-23 Thread Michael Nordman
2011/8/23 Jonas Sicking jo...@sicking.cc On Tue, Aug 23, 2011 at 12:53 AM, Anne van Kesteren ann...@opera.com wrote: On Tue, 23 Aug 2011 02:25:38 +0200, Jonas Sicking jo...@sicking.cc wrote: Given that this seems to be the way people prefer to do it, I'm fine with doing that for Gecko

Re: [XHR2] Blobs, names and FormData

2011-08-22 Thread Michael Nordman
A few of us on the chrome team just discussed this. We see this as a deficiency in the FormData interface and intend to address it by providing a variant of FormData.append(...) that allows the caller to provide a 'filename' when appending a blob. We don't intend to implement

Re: [XHR2] Blobs, names and FormData

2011-08-22 Thread Jonas Sicking
Given that this seems to be the way people prefer to do it, I'm fine with doing that for Gecko too. But we definitely would need to get FormData.append changed so that it supports the use case. / Jonas On Mon, Aug 22, 2011 at 1:40 PM, Michael Nordman micha...@google.com wrote: A few of us on

RE: [XHR2] Blobs, names and FormData

2011-07-18 Thread Adrian Bateman
On Monday, July 11, 2011 12:46 PM, Charles Pritchard wrote: Problem is too strong a statement. I am all for trivial changes, part of my advocacy for getFile is from past experiences when blob was less supported; getFile would have helped. FileReader has base64 encoding for binary data--

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Charles Pritchard
On 7/18/2011 12:09 PM, Adrian Bateman wrote: On Monday, July 11, 2011 12:46 PM, Charles Pritchard wrote: Problem is too strong a statement. I am all for trivial changes, part of my advocacy for getFile is from past experiences when blob was less supported; getFile would have helped. FileReader

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Michael Nordman
The problem is around naming the binary parts attached to multi-part-form-encoded FormData. I think I'm in favor of the more direct solution to this problem, providing a FormData.append() variant that optionally allows the caller to specify a name. If no name is provided and the blob is a File,

RE: [XHR2] Blobs, names and FormData

2011-07-18 Thread Adrian Bateman
On Monday, July 18, 2011 12:52 PM, Michael Nordman wrote: The problem is around naming the binary parts attached to multi-part-form-encoded FormData. I think I'm in favor of the more direct solution to this problem, providing a FormData.append() variant that optionally  allows the caller to

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Glenn Maynard
2011/7/18 Michael Nordman micha...@google.com BlobBuilder.getFile() as a solution to this particular problem is less direct (and less obvious and less discoverable so less friendly). And it raises questions like... Is the blob data really flattened out as a file on the disk somewhere? If not,

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Jonas Sicking
2011/7/18 Adrian Bateman adria...@microsoft.com: On Monday, July 11, 2011 12:46 PM, Charles Pritchard wrote: Problem is too strong a statement. I am all for trivial changes, part of my advocacy for getFile is from past experiences when blob was less supported; getFile would have helped.

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Charles Pritchard
On 7/18/2011 2:42 PM, Jonas Sicking wrote: If there is an API that replies on File to work correctly we think we should fix it to work with Blob. For example, FileReader is really BlobReader and works fine with Blobs. To me, getFile() should be unnecessary and the best fix for FormData

Re: [XHR2] Blobs, names and FormData

2011-07-18 Thread Jonas Sicking
On Mon, Jul 18, 2011 at 2:52 PM, Charles Pritchard ch...@jumis.com wrote: On 7/18/2011 2:42 PM, Jonas Sicking wrote:  If there is an API that replies on File to  work correctly we think we should fix it to work with Blob. For example, FileReader is  really BlobReader and works fine with

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Anne van Kesteren
On Thu, 07 Jul 2011 03:00:55 +0200, Adrian Bateman adria...@microsoft.com wrote: 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

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Jonas Sicking
2011/7/11 Anne van Kesteren ann...@opera.com: On Thu, 07 Jul 2011 03:00:55 +0200, Adrian Bateman adria...@microsoft.com wrote: 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

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Jonas Sicking
On Mon, Jul 11, 2011 at 10:12 AM, Adrian Bateman adria...@microsoft.com wrote: On 11 July 2011 10:02, Jonas Sicking wrote: Additionally, what is the use case of being able to set the filename during a FormData submission? My perception was that the main use case was to not get an empty

RE: [XHR2] Blobs, names and FormData

2011-07-11 Thread Adrian Bateman
On 11 July 2011 10:53, Jonas Sicking wrote: On Mon, Jul 11, 2011 at 10:12 AM, Adrian Bateman adria...@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

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Charles Pritchard
getFile could work with dataTransfer for dropping files onto the desktop. There may be other Apis which work with File but not with Blob, or not as well with Blob. Blob already requires linking/abstraction from createObjectUrl. Internally, getFile could simply run createObjectUrl and treat it

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Jonas Sicking
2011/7/11 Adrian Bateman adria...@microsoft.com: On 11 July 2011 10:53, Jonas Sicking wrote: On Mon, Jul 11, 2011 at 10:12 AM, Adrian Bateman adria...@microsoft.com wrote: Some content management systems use the original filename by default when storing files in document libraries. It's

RE: [XHR2] Blobs, names and FormData

2011-07-11 Thread Adrian Bateman
From: Charles Pritchard Sent: 11-Jul-11 12:03 PM To: Adrian Bateman Cc: Jonas Sicking; Anne van Kesteren; Julian Reschke; Alfonso Martínez de Lizarrondo; Webapps WG Subject: Re: [XHR2] Blobs, names and FormData getFile could work with dataTransfer for dropping files onto the desktop

Re: [XHR2] Blobs, names and FormData

2011-07-11 Thread Charles Pritchard
Subject: Re: [XHR2] Blobs, names and FormData getFile could work with dataTransfer for dropping files onto the desktop. There may be other Apis which work with File but not with Blob, or not as well with Blob. Blob already requires linking/abstraction from createObjectUrl. Internally, getFile

RE: [XHR2] Blobs, names and FormData

2011-07-06 Thread Adrian Bateman
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

Re: [XHR2] Blobs, names and FormData

2011-07-02 Thread Anne van Kesteren
On Wed, 29 Jun 2011 20:17:52 +0200, Jonas Sicking jo...@sicking.cc wrote: Just a small nit: We would also use blob for File objects with an empty .name property, right? Done: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#dom-formdata-append -- Anne van Kesteren http://annevankesteren.nl/

Re: [XHR2] Blobs, names and FormData

2011-06-30 Thread Julian Reschke
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

Re: [XHR2] Blobs, names and FormData

2011-06-30 Thread Alfonso Martínez de Lizarrondo
I thought that the browser could retrieve that info from the os based on the proposed extension. I just requested the part that I needed, if there's something else missing then I guess that it should be possible to add it at the same time. El 30/06/2011 09:28, Julian Reschke julian.resc...@gmx.de

Re: [XHR2] Blobs, names and FormData

2011-06-30 Thread Julian Reschke
On 2011-06-30 09:54, Alfonso Martínez de Lizarrondo wrote: I thought that the browser could retrieve that info from the os based on the proposed extension. 1) the OS may not know 2) it also needs to be sent over the wire some way... I just requested the part that I needed, if there's

Re: [XHR2] Blobs, names and FormData

2011-06-30 Thread Anne van Kesteren
On Wed, 29 Jun 2011 20:17:52 +0200, Jonas Sicking jo...@sicking.cc wrote: Just a small nit: We would also use blob for File objects with an empty .name property, right? I guess we can do that. getFile() should also specify a media type by the way. -- Anne van Kesteren

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Alfonso Martínez de Lizarrondo
I didn't notice this thread and I filed [1] in webkit due to this behavior. 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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Jonas Sicking
On Wednesday, June 29, 2011, Alfonso Martínez de Lizarrondo aml...@gmail.com wrote: I didn't notice this thread and I filed [1] in webkit due to this behavior. Providing an automatic filename it's better than sending an empty one, but it fails to address interaction with existing systems (some

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Alfonso Martínez de Lizarrondo
2011/6/29 Jonas Sicking jo...@sicking.cc On Wednesday, June 29, 2011, Alfonso Martínez de Lizarrondo aml...@gmail.com wrote: I didn't notice this thread and I filed [1] in webkit due to this behavior. Providing an automatic filename it's better than sending an empty one, but it fails to

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Anne van Kesteren
On Wed, 29 Jun 2011 16:43:13 +0200, Alfonso Martínez de Lizarrondo aml...@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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Alfonso Martínez de Lizarrondo
2011/6/29 Anne van Kesteren ann...@opera.com On Wed, 29 Jun 2011 16:43:13 +0200, Alfonso Martínez de Lizarrondo aml...@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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Anne van Kesteren
On Wed, 29 Jun 2011 18:21:39 +0200, Alfonso Martínez de Lizarrondo aml...@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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Alfonso Martínez de Lizarrondo
2011/6/29 Anne van Kesteren ann...@opera.com On Wed, 29 Jun 2011 18:21:39 +0200, Alfonso Martínez de Lizarrondo aml...@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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Anne van Kesteren
On Wed, 29 Jun 2011 18:34:58 +0200, Alfonso Martínez de Lizarrondo aml...@gmail.com wrote: 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

Re: [XHR2] Blobs, names and FormData

2011-06-29 Thread Jonas Sicking
2011/6/29 Anne van Kesteren ann...@opera.com: On Wed, 29 Jun 2011 18:34:58 +0200, Alfonso Martínez de Lizarrondo aml...@gmail.com wrote: My first simple approach was: formdata.append(elementName, blob, picture.png); Jonas has suggested instead blobbuilder.getFile(picture.png) I don't

Re: [XHR2] Blobs, names and FormData

2011-06-28 Thread Jonas Sicking
On Fri, Jun 17, 2011 at 9:24 AM, Jonas Sicking jo...@sicking.cc wrote: On Friday, June 17, 2011, Anne van Kesteren ann...@opera.com wrote: On Wed, 20 Apr 2011 23:52:21 +0200, Jonas Sicking jo...@sicking.cc wrote: When a Blob is appended to a FormData, the XHR2 spec currently says that the

Re: [XHR2] Blobs, names and FormData

2011-06-17 Thread Anne van Kesteren
On Wed, 20 Apr 2011 23:52:21 +0200, Jonas Sicking jo...@sicking.cc wrote: When a Blob is appended to a FormData, the XHR2 spec currently says that the filename used should be the empty string unless the Blob is also a File. If such a FormData is later submitted using XMLHttpRequest, this will

Re: [XHR2] Blobs, names and FormData

2011-06-17 Thread Jonas Sicking
On Friday, June 17, 2011, Anne van Kesteren ann...@opera.com wrote: On Wed, 20 Apr 2011 23:52:21 +0200, Jonas Sicking jo...@sicking.cc wrote: When a Blob is appended to a FormData, the XHR2 spec currently says that the filename used should be the empty string unless the Blob is also a File.

[XHR2] Blobs, names and FormData

2011-04-20 Thread Jonas Sicking
Hi All, When a Blob is appended to a FormData, the XHR2 spec currently says that the filename used should be the empty string unless the Blob is also a File. If such a FormData is later submitted using XMLHttpRequest, this will result in a request that contains something similar to: