Updating a progress bar during php scripts

by  |  15-Sep-2016 16:31

Providing a progress indicator gives users useful information and lets them know exactly what’s going on.At first thought, you might think accomplishing this can be done easily by first obtaining the file’s size from the user’s computer and then performing some simple calculations against the directory on the server where the file is being uploaded to.

updating a progress bar during php scripts-24updating a progress bar during php scripts-32updating a progress bar during php scripts-25

The div with the ID “bar_color” will be dynamically updated as the file upload progresses.

The “status” div will display the numeric value of the percent uploaded.

As of PHP 5.4, they’ve done it again with a new set of configuration directives, .

In this article I’ll show you how this feature can be used to create a simple upload progress bar without any external libraries or browser dependencies.

In fact, this is a common practice when doing “Ajax file uploads” since it isn’t possible to send the contents of a file directly using Java Script’s , is pretty straight-forward.

Community Discussion