Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Uploadprogress extension function always returning null, with no upload data

I am using php 5.3.2 with uploadprogress extension to get a progressbar during upload using zend framework. Even the demo provided with zend is not working. code in zend example -

if (isset($_GET['uploadId'])) {
set_include_path(realpath(dirname(__FILE__) . '/../../../library')
                 . PATH_SEPARATOR . get_include_path());

require_once 'Zend/ProgressBar.php';
require_once 'Zend/ProgressBar/Adapter/JsPull.php';
require_once 'Zend/Session/Namespace.php';

$data          = uploadprogress_get_info($_GET['uploadId']);
$bytesTotal    = ($data === null ? 0 : $data['bytes_total']);
$bytesUploaded = ($data === null ? 0 : $data['bytes_uploaded']);

$adapter     = new Zend_ProgressBar_Adapter_JsPull();
$progressBar = new Zend_ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');

if ($bytesTotal === $bytesUploaded) {
    $progressBar->finish();
} else {
    $progressBar->update($bytesUploaded);
}

}

uploadprogress_get_info always returns null. I thought something is wrong with my code so i downloaded the working sample available at http://labs.liip.ch/uploadprogresssimple/index.php but even in that case in uploadprogress_get_info always return null.

My uploadprogress config values

uploadprogress support enabled

Version 1.0.1

uploadprogress.file.contents_template /tmp/upload_contents_%s

uploadprogress.file.filename_template /tmp/upt_%s.txt

uploadprogress.get_contents 1

While googling around i found uploadprogress extension has some issue with Suhosin Patch < 0.9.26 but i am using Suhosin Patch 0.9.9.1

like image 493
abhinavlal Avatar asked Feb 19 '26 15:02

abhinavlal


1 Answers

Are you testing this locally? I mean testing this on localhost? try upload to a remote host, or test a rather large file (make sure you bumped upload_max_filesize and post_max_size before).

like image 194
racetrack Avatar answered Feb 21 '26 03:02

racetrack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!