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

Re: New FileAPI Draft | was Re: FileAPI feedback

From: Nikunj R. Mehta <nikunj.mehta@oracle.com>
Date: Mon, 17 Aug 2009 16:26:22 -0700
Cc: Gregg Tavares <gman@google.com>, Dmitry Titov <dimich@chromium.org>, Web Applications Working Group WG <public-webapps@w3.org>
Message-Id: <F8B8084F-7D37-4835-835D-96B3F00313AA@oracle.com>
To: arun@mozilla.com

On Aug 12, 2009, at 7:29 AM, Arun Ranganathan wrote:

> Gregg Tavares wrote:
>> How about this?
>> Why make a new API for getting the contents of a file (local or  
>> otherwise)
>> when we already have one which is XHR?
>> What if FileList was just array of File objects where each File  
>> object is
>> just a URL in the format
>> "filedata: uuid, filename"
>> Then you can use that URL anywhere in HTML a URL is valid. script,  
>> img,
>> audio, video, css, AND XHR
>> That would mean you wouldn't be adding a new API to get the  
>> contents of a
>> file. If you want the contents just use XHR and use the URL from  
>> the File in
>> the FileList.
>> You could add a few more functions to XHR like  
>> request.getAsDataURL(),
>> request.getAsTextInEncodiing(), etc. if need be if they are neede
> Today, it's possible to use XHR from "privileged web content" in  
> Firefox to access file:// URLs; the drawback is that these don't  
> return HTTP responses, and of course there are security  
> considerations.

As stated, the XHR algorithm for open() [1] allows relative references  
and resolves them relative to the document base URI. Does that mean  
that if the document was loaded using file: uri, then the XHR could be  
used for loading a file?

As a separate question, it would be necessary for proper operation of  
XHR to always provide content-type and content-length headers when  
providing a response entity body. Does Firefox provide these headers  
when the XHR object is used to retrieve local file: representations?

> I'm not sure it is necessary to reuse the XHR primitive for general  
> file access (though I find the idea of not distinguishing remote  
> files from local pretty attractive), but I have defined the  
> filedata: URL scheme to return some HTTP response codes [1], so that  
> it can be used with XHR.  What is permitted and what is not is bound  
> to be a controversial discussion :-)
> -- A*
> [1] http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html


[1] http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest
Received on Monday, 17 August 2009 23:29:16 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:18 UTC