On 9/21/07, Robert O'Callahan <[EMAIL PROTECTED]> wrote: > Actually we have an experimental API for this now. See here: > http://mxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMNSHTMLInputElement.idl#55 > http://mxr.mozilla.org/seamonkey/source/content/base/public/nsIDOMFileList.idl > http://mxr.mozilla.org/seamonkey/source/content/base/public/nsIDOMFile.idl > The core is: > readonly attribute DOMString fileName; > readonly attribute unsigned long long fileSize; > > > DOMString getAsText(in DOMString encoding); > // raises(FileException) on retrieval > DOMString getAsDataURL(); > // raises(FileException) on retrieval > > DOMString getAsBinary(); > // raises(FileException) on retrieval > > These should be self-explanatory. > > I guess this isn't great for really huge files, but multi-megabyte files > should be OK on most machines, and it avoids having to deal with a > client-writable "cache". It obviously has some interesting uses for online > apps as well. >
It'd be possible to extend this to avoid bringing these files into memory. We'd just need globalStorage (or something like it) to accept/return nsIDOMFile objects, and a way for XHR to send them. -dave
