php file upload with a progressbar or number of percent

I want to use a file upload progress. Can anybody give possible simple code for showing upload progess bar. On the next code. There is file receiving file upload.php

if ($_FILES) {
    foreach ($_FILES as $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>";

And there is a html with file upload form.

<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <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">

Thank you


The easiest way to do it is to use jQuery uploadify plugin, which includes swfobject and shows file upload progress bar. And it's a beautiful way of uploading multiple files.

jQuery uploadify plugin:

If you want to do it your own way you need server-side compatibility, some nginx or apache2 module that can handle upload progress. And your client-side should make a requests to server during all upload process to get all information about it.

You can use jQuery form plugin to achieve this. Just add jQuery Form plugin to your page head section. And you can use the following code.

$(function() {
 var percent = $('#percent');
 var status = $('#status');
 beforeSend: function() {
 var percentVal = '0%';
 uploadProgress: function(event, position, total, percentComplete) {
 var percentVal = percentComplete + '%';
 complete: function(xhr) {

I got it from this File Upload Progress Bar Tutorial. And it is working absolutely fine.

Need Your Help

Get Html from a Url in ASP.NET MVC

c# html

I need to save a page from url - This page is in my own application - in html format. This html will then be send by email to a user. Any anyone knows how?

Java bluetooth keyboard

java bluetooth keyboard

I am wondering where to get started if I want to have my java program communicate over bluetooth?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.