Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet Explorer Caching File Uploads?

I have a very basic page that includes an <input type="file"> element. When I submit the form with a file selected, the server responds with a spreadsheet that gets opened in Excel (a "new window"). The implication of this behavior is that the initial screen and input element are still visible in IE. If I change the data on disk of the selected file and resubmit the form, Internet Explorer uploads the old contents a second time; my latest changes are not present in the content sent to the server. If I select the file via the input's Browse... button again, the new file contents are uploaded as expected. Firefox always sends the file's contents from disk which is the expected/desired behavior. It seems that Internet Explorer is doing some kind of caching of the uploaded file contents.

Is there any way to disable this "feature" and have IE pull the data from disk each time the form is submitted?

Is there any documentation available on this behavior? It's the first time I've encountered it and my searches have largely come up empty.

like image 234
Todd Avatar asked Apr 01 '15 16:04

Todd


1 Answers

You can test out the conjecture with live demos posted on MS-Connect.

[...] the bug began with IE10, when FileList and Blob were implemented.
input.files is an html5 FileList of file/blob items.
To populate it, IE blobs each filepicker choice. They have a "snapshot state" (W3C term).
They're kept sync'd in case a selected file is updated before submission.
The bug is, IE fails to detect if the file is deleted, renamed, or replaced.
The filepicker snapshot goes stale in that circumstance.

Here is what happens when a file is selected in filepicker, then renamed and edited, prior to submitting the filepicker selection. Although a new file (with original filename) has been substituted in its place, the original file (now with different name and modified text) gets sent in the form. How is this possible? It is as though it was tracked via ntfs ObjectID, which is used with Distributed Link Tracking. Note carefully in this screenshot, the file name does not agree with the file content.

So, it's not a "caching" thing at all. It's a tracking bug.

like image 112
user4749485 Avatar answered Nov 02 '22 19:11

user4749485