Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12294 closed enhancement (wontfix)

Replace getAsBinary() which is depricated/non-standard

Reported by: Simon Speich Owned by: Mike Wilcox
Priority: high Milestone: tbd
Component: DojoX Form Version: 1.6.0b1
Keywords: uploader, html5, binary, file, read Cc:
Blocked By: Blocking:

Description

dojox/trunk/form/uploader/plugins/HTML5.js uses the method File.getAsBinary() on line 170, which is depricated/non-standard now.

see http://www.w3.org/TR/FileAPI/#file or https://developer.mozilla.org/en/DOM/File

The line 170 :

binary = this.inputNode.files[i].getAsBinary() + EOL;

could be replaced with:

reader = new FileReader();
reader.onload = function(evt) {
	binary = evt.target.result + EOL;
};
reader.readAsBinaryString(this.inputNode.files[i]);

Change History (4)

comment:1 Changed 8 years ago by bill

Owner: changed from dante to Mike Wilcox

comment:2 Changed 8 years ago by Mike Wilcox

Resolution: wontfix
Status: newclosed

Thanks Simon, I appreciate any extra knowledge for file inputs since general information is so sparse. But that section was meant to be temporary all along to work with FF3.X. As of 4.0, it's going to use the other section (which currently supports Webkit) for FormData?(), which works well and is very versatile for handling not just the file but the entire form in which the file input may reside.

comment:3 Changed 8 years ago by Simon Speich

Just an additional note using multipart/form-data: It might not really be a problem, but on the server side, if you are using PHP to read the request's body, it says in the manual on http://www.php.net/manual/en/wrappers.php.php:

php://input is not available with enctype="multipart/form-data".

which means you can't do:

file_get_contents("php://input")

comment:4 Changed 8 years ago by Mike Wilcox

More good info on wrappers. We should be safe though - the enctype is only necessary if doing a traditional non-ajax page/form post. And I of course tested that, and it works (and doesn't work without it). For Ajax-posts, the data is pulled out of the form and sent via xhr.

Note: See TracTickets for help on using tickets.