This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22682 - forms: Make <input type=file>.files writable
Summary: forms: Make <input type=file>.files writable
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other All
: P3 enhancement
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-15 23:54 UTC by Ian 'Hixie' Hickson
Modified: 2017-07-24 03:22 UTC (History)
9 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2013-07-15 23:54:58 UTC
Would be good to be able to do some or all of the following:

   input.files = [blob1, file1, blob2, blob3, file2];

   input.files.empty();
   input.files.append(blob1);
   input.files.append(file1);

Maybe by making HTMLInputElement.files return an object that inherits from FileList and extends it, and by having input.files have some sort of PutForwards- like magic that takes an array.
Comment 1 Ian 'Hixie' Hickson 2013-07-15 23:57:05 UTC
Also desired (ack Nico Weber):

   input.files = dataTransfer.files;

...to copy the files from a drag-and-drop operation onto an <input> element for submission.

But I don't think we should actually set the FileList object itself; seems dangerous to have the object identity change... cc'ing Boris who may have relevant opinions on API design around this.
Comment 2 Ian 'Hixie' Hickson 2013-07-15 23:57:59 UTC
Space here may be constrained by implementations:
   https://bugs.webkit.org/show_bug.cgi?id=87154
   https://bugzilla.mozilla.org/show_bug.cgi?id=757664
Comment 3 Boris Zbarsky 2013-07-16 01:35:43 UTC
In the thread starting http://lists.w3.org/Archives/Public/public-script-coord/2013AprJun/0153.html most people felt that having setters and getters that return different types, and generally setters that do various magic things to what's being set, is pretty odd API...

I don't know that I have a strong opinion myself, yet.
Comment 4 Ian 'Hixie' Hickson 2013-10-03 20:14:22 UTC
So WebKit now does comment 1, with the object changing identity. Nothing in comment 0 has been implemented so far by anyone as far as I can tell.
Comment 5 Boris Zbarsky 2013-10-03 21:10:01 UTC
When you say "changing identity" do you mean that after I do:

   input.files = dataTransfer.files;

then input.files === dataTransfer.files tests true?  Or that it test false?
Comment 6 Ian 'Hixie' Hickson 2013-10-04 19:49:20 UTC
It tests true.
Comment 7 Ian 'Hixie' Hickson 2013-10-14 19:52:27 UTC
Spec-wise, I'm not sure how to proceed. I need two implementors intending on converging on the same thing or willing to implement the same proposal before I can update the spec. Moving back to "Needs Impl Interest" for now.
Comment 8 Anne 2017-07-21 11:07:52 UTC
Please file a new issue at https://github.com/whatwg/html/issues/new if this is still desired.
Comment 9 Kent Tamura 2017-07-24 03:22:21 UTC
(In reply to Anne from comment #8)
> Please file a new issue at https://github.com/whatwg/html/issues/new if this
> is still desired.

Filed: https://github.com/whatwg/html/issues/2861