Created
May 11, 2020 07:09
-
-
Save AliceLR/83b9386abb962486118578d6e99a5791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// NOTE: this code doesn't cause the segmentation fault very often, but if e.g. a large script | |
// is included here the crash happens more often. | |
if ($_GET['progress']) { var_dump(uploadprogress_get_info(strval($_GET['progress']))); die(); } | |
if ($_POST['UPLOAD_IDENTIFIER']) { die("it worked."); } | |
$uID = floor(microtime(true) * rand(0,65535)); | |
?> | |
<html> | |
<body> | |
<script type="text/javascript"> | |
function checkprogress() { | |
var h = new XMLHttpRequest(); | |
function printprogress() { | |
if(h.readyState === XMLHttpRequest.DONE && h.status === 200) { | |
var date = new Date(); | |
document.getElementById('out').innerHTML = h.responseText + "(" + date.getTime() + ")"; | |
} | |
} | |
h.onreadystatechange = printprogress; | |
h.open('GET', 'test.php?progress=<?=$uID ?>', true); | |
h.send(); | |
setTimeout(checkprogress, 200); | |
} | |
function getprogress() { setTimeout(checkprogress, 50); }; | |
</script> | |
<form name="uploaderForm" action="#" enctype="multipart/form-data" method="post"> | |
<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?=$uID ?>"></input> | |
<input type="file" name="upload"></input> | |
<input type="submit" value="Upload" onclick="getprogress()"></input> | |
<div id="out"></div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment