views:

338

answers:

4

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

A: 

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).

racetrack
I'm testing locally from a different computer on lan with firefox throttle addon to simulate slow speed. Upload happens and takes its time to get done.
abhinavlal
A: 

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

I am on the same Suhosin version and having this issue. Also tried apc_fetch() which suhosin has also crippled.

What a stupid patch. To remove it I have to rebuild php. For f*** sake!

Keyo
A: 

Same problem for me as well though I am using Zend_File_Transfer_Adapter to handle the upload. Its useful because you can validate the uploaded file(s) too :)

A couple of useful methods that could help you at least on the configuration of your server is:

Zend_File_Transfer_Adapter_Http::isApcAvailable();
Zend_File_Transfer_Adapter_Http::isUploadProgressAvailable();
lintal
A: 

Hello @all,

I found this question about zend and uploadprogress very interesting and now I want to realize a upload with a progressbar in zend but I don't know how to start. Could anyone help me and give me some informations, code snippets...?
Do anyone know how I have to add the extension php_uploadprgress in ZendServer (in xampp there is no problem)?
I hope that anybody could help me because I try it since Monday without any result...
Greetings
Marcel

PS: I don't want to know how I create a project in zend, only how I could say my form/action (dijit-style) I want so see a progress.

PPS: Is there any code for this examplde (http://labs.liip.ch/uploadprogresssimple/) available?

Marcel
hi marcel, take a look at this question http://stackoverflow.com/questions/1222609/implementing-file-upload-progress-with-zend which is more relevent to your question.Also the code example you mentioned can be found here http://cvs.php.net/viewvc.cgi/pecl/uploadprogress/examples/
abhinavlal