XMLHttpRequest sending empty file when using new File() and Formdata() - iOS only
Reported by
benoit.g...@gmail.com,
Nov 12 2017
|
|||||
Issue description
Steps to reproduce the problem:
Run following code :
<script>
let file = new File(['testestestest'], "test.ext");
console.log('Client-side size : ', file.size);
fd.append("file", file);
let request = new XMLHttpRequest();
request.open("POST", "server_script.php");
request.send(fd);
request.onreadystatechange = function(e) {
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
let obj = JSON.parse(this.responseText);
console.log('Server-side size :', obj.files.file.size);
}
}
}
</script>
Server script (server_script.php) :
<?php
header('Content-Type: application/json');
echo json_encode(['files' => $_FILES]);
What is the expected behavior?
Logging "Client-side size : 13", then "Server-side size : 13"
What went wrong?
Logging "Client-side size : 13", then "Server-side size : 0"
Sent file is empty.
Did this work before? N/A
Chrome version: 62.0.3202.70 Channel: stable
OS Version: 11.1.1
Flash Version:
,
Nov 14 2017
,
Nov 16 2017
To danyao for web compat.
,
Nov 16 2017
,
Nov 16 2017
This is a bug in WebKit, because I can repro in Safari (both iOS and desktop). It appears to be fixed because I can no longer repro the bug in Safari Tech Preview 43, and in ios-simulator at WebKit head. When Apple releases the WebKit update, Chrome will get the fix for this bug. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by benoit.g...@gmail.com
, Nov 12 2017