html - php file upload with a progressbar or number of percent -


i want use file upload progress. can give possible simple code showing upload progess bar. on next code. there file receiving file upload.php

<?php if ($_files) {     foreach ($_files $k => $v) {         if ($v["error"] > 0) {             echo "error: " . $_files["file"]["error"] . "<br>";         } else {             echo "upload: " . $v["name"] . "<br>";             echo "type: " . $v["type"] . "<br>";             echo "size: " . ($v["size"] / 1024) . " kb<br>";             echo "stored in: " . $v["tmp_name"]. "<br><br>";         }     }     return; } ?> 

and there html file upload form.

<!doctype html> <html>     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8">         <title>upload</title>     </head>     <body>         <form action="upload.php" method="post" enctype="multipart/form-data">             <label for="f1">filename:</label>             <input type="file" name="f1" id="f1"><br>             <label for="f2">filename:</label>             <input type="file" name="f2" id="f2"><br>             <input type="submit" name="submit" value="submit">         </form>     </body> </html> 

thank you

the easiest way use jquery uploadify plugin, includes swfobject , shows file upload progress bar. , it's beautiful way of uploading multiple files.

jquery uploadify plugin:

http://www.uploadify.com/

if want own way need server-side compatibility, nginx or apache2 module can handle upload progress. , client-side should make requests server during upload process information it.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -