The PHP Uploadprogress extension function always returns null, with no upload data

I am using php 5.3.2 with the uploadprogress extension to get a progress indicator on upload using the zend framework. Even the demo with zend does not work. The code in the zend example is

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 was wrong with my code, so I downloaded the working sample available at http://labs.liip.ch/uploadprogresssimple/index.php , but even so, null is always returned in uploadprogress_get_info.

My uploadprogress configuration settings

uploadprogress support

Version 1.0.1

uploadprogress.file.contents_template / tmp / upload_contents_% s

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

uploadprogress.get_contents 1

googling , uploadprogress Suhosin Patch < 0.9.26, Suhosin Patch 0.9.9.1

+3
4

? localhost? (, upload_max_filesize post_max_size ).

+1

googling , uploadprogress Suhosin Patch < 0.9.26, Suhosin Patch 0.9.9.1

. apc_fetch(), suhosin.

. , php. f *** !

+1

, Zend_File_Transfer_Adapter . , ():)

, , , :

Zend_File_Transfer_Adapter_Http::isApcAvailable();
Zend_File_Transfer_Adapter_Http::isUploadProgressAvailable();
+1
  • phpinfo, , UploadProgress, tmp . "uploadprogress.file.filename_template" tmp phpinfo.

  • , , uploadprogress.

    < div id = "status "style =" border: 1px black solid; <? php
    $ templateini = ini_get ( "uploadprogress.file.filename_template" );
    $ testid =" thisisjustatest ";
    $ template = sprintf ($ templateini, $testid);
    $ templateerror = false;
    if ($ template && $template!= $templateini && @touch ($ template) & file_exists ($ template)) {
    //print '('. $templateini. ' . :. str_replace ($ testid, "% s", realpath ($ template)).') ';

    unlink ($ template);
    } else {
    $ templateerror = true;
    }
    if (function_exists (" uploadprogress_get_info ")) {
    if ($ templateerror) {
    print 'background-color: red;" ';
    print " > .";
    if ($ template == $templateini) {
    print "uploadprogress.file.filename_template ($ templateini) % s . , . < br/ > ";
    } else {
    print" $templateini . < br/ > , , -. < br/ >
    ini 'uploadprogress.file.filename_template' . "
    }
    } else {
    print 'background-color: green;" → uploadprogress , , ";
    }
    } else {
    ? >
    background-color: red; " > uploadprogress . <? php}? >

    </ div>

  • If the above code gives an error, specify the correct tmp directory in the php.ini file. The following line was added to the php.ini file for the tamp Xampp directory on the localhost machine on Windows. uploadprogress.file.filename_template = C: \ xampp \ tmp \ some_name_% s.txt

  • Now run the Zend demo, it should work or run the following command to get var_dump manually. var_dump (uploadprogress_get_info ($ _ GET ['uploadId']));

0
source

Source: https://habr.com/ru/post/1745546/


All Articles