This article describes the PHP upload file and show the way to upload progress. Share to everyone for your reference. Specifically as follows:
Remember to upload the file when the larger, or not yet see it uploaded, and upload the file not too big, on the G's even, 2G I tried, PHP can't stand, I tested is more than 300 m, remember to adjust the small php.ini parameters Ah "Selected documents =" submitted = "Get information" to coherent oh ^ ^
<?php $prefix = ini_get (' Session.upload_progress.prefix ');
$name = Ini_get (' Session.upload_progress.name '); $key = $prefix.
$name;
Session_Start ();
if (Isset ($_post[' Get_info ')) {$logo = $prefix. $_post[' logo '];
Exit (Json_encode ($_session[$logo])); } elseif ($_post) {echo ' <script>var finashed = True;</script> ';}?> <div id= ' Show_info_div ' >< /div> <form action= "index.php" method= "POST" enctype= "Multipart/form-data" > <input type= "hidden" name= " <?php echo $name?> "value=" Test "> <input type=" file "name=" file "><br> <input type=" Submit "V Alue= "Submit" > <input type= "button" value= "Get Information" onclick= "Getuploadinfo ()" > </form> <script src= "
Jquery.js "></script> <script> var sto = null;
var progress = null; function Getuploadinfo () {$.post ("index.php", {"Get_info": 1, "logo": "Test"}, function (data) {data = eval ("+
Data + ")"); progress = parseint (parseint (data.bytes_processed) * 10000/parseint (Data.content_length))/100 + "%";
document.getElementById ("Show_info_div"). InnerHTML = progress;
STO = settimeout ("Getuploadinfo ()", 1000);
}); } if (typeof (finashed)!== "undefined") {document.getElementById ("Show_info_div"). InnerHTML = "100% (Upload success!)
)"; } </script>
I hope this article will help you with your PHP programming.