Displaying an upload progress bar

Especially when importing a large file, it's interesting to have a visual feedback on the progression of upload. Please note that the progress bar we are discussing here informs us only about the uploading part, which is a subset of the whole import operation.

Having a JavaScript-enabled browser is a requirement for this feature. Moreover, the web server's PHP component must have the JSON extension and at least one of these extensions:

phpMyAdmin uses AJAX techniques to fetch progress information, then displays it as part of the File to import dialog. The number of bytes uploaded, total number of bytes, and percentage uploaded are displayed under the bar.

Configuring APC

A few php.ini directives play an important role for upload progress. First, the apc.rfc1867 directive must be set to On or true, otherwise this extension won't be reporting upload progress to the calling script. When set to On, this extension updates an APC user cache entry with the upload status information.

Also, the frequency of the updates can be set via the apc.rfc1867_freq directive, which can take the form of a percentage of the total file size (for example, apc.rfc1867_freq = "10%"), or a size in bytes (suffixes k for kilobytes, m for megabytes, and g for gigabytes are accepted). A value of 0 here indicates us to update as often as possible, which looks interesting but in reality may slow down the upload.

This very notion of update frequency explains why the bar progresses in chunks rather than continuously when using this mechanism.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.104.230