UPLOAD with progess bar

See all posts Reply

UPLOAD with progess bar new!
by u2tas, 17 years, 7 months ago
Can someone make progess bar, for this upload? Maybe author can make new version with this feature?Reply
Re: UPLOAD with progess bar new!
by colin, 17 years, 7 months ago
It is not possible to an an upload meter with PHP as of now. But it will come in the next versions of PHP, with a bit of luck.

More information here: http://pdoru.from.ro/

When the meter will be part of PHP, I will see what is possible to do. But the class is a low-level tool, and the upload meter is a GUI thing. So...Reply
Re: UPLOAD with progess bar new!
by kren, 17 years, 3 months ago
what about ajax-dhtml implementation like this one:
http://www.scbr.com/docs/products/dhtmlxVault/index.shtml
;)Reply
Re: UPLOAD with progess bar new!
by colin, 17 years, 3 months ago
It can work with the dhtmlxVault script. Simple use the class to handle the upload in the file samples/php/UploadHandler.php that is provided in their package.

The class being low-level, it can be implemented in almost all upload scripts.Reply
Re: UPLOAD with progess bar new!
by kren, 17 years, 3 months ago
Yes you were right it works perfectly!!!
There were few things to correct for debugger ..$handle->log to work
...must say that it was very easy to implement
now there is no need to use foreach(..) for multiple uploads ;)

...many many thanx for this excellent tool you're the bestReply
Re: UPLOAD with progess bar new!
by colin, 17 years, 3 months ago
Cool!

Could you please copy and paste here your code, so that others can use it too?Reply
Re: UPLOAD with progess bar new!
by kren, 17 years, 3 months ago
OK,
this is UploadHandler.php ......
include('class.upload.php');
$id  = $_GET['sessionId'];
$id = trim($id);

session_name($id);
session_start();
$inputName = $_GET['userfile'];
$tempLoc   = $_FILES[$inputName]['tmp_name'];
echo $_FILES[$inputName]['error'];

$handle = new upload($_FILES[$inputName]);
if ($handle->uploaded) {
  /*********Optional for image manipulation*********
  $handle->file_new_name_body   = 'image_resized';
  $handle->image_resize         = true;
  $handle->image_x              = 100;
  $handle->image_ratio_y        = true;
  */
  $handle->process('../../uploadDir');
  if ($handle->processed) {
    $_SESSION['value'] = -1;
    /****** for debugger `class.upload.php` uncomment this line *******/
    //$_SESSION['error'] = $handle->log;
    $handle->clean();
  } else {
    echo 'error : ' . $handle->error;
  }
}


then for debugging .... correct file: GetInfoHandler.php
$id = $_POST['sessionId'];
$id = trim($id);
session_name($id);
session_start();
echo $_SESSION['value'];
/****** for debbuger `class.upload.php` uncomment this line *******/
//echo $_SESSION['error'];
if($_SESSION['value']==-1) {
    session_destroy();
}

..and at last for output debugger find this line in file dhtmlXVault.js:
tblContent.rows[1].cells[0].innerHTML += "Done";

and add these lines bellow:
/****** for debugger `class.upload.php` uncomment this two lines *******/
//result = xmlHttp.responseText;                            
//tblContent.rows[1].cells[0].innerHTML += result;

enjoy! :)Reply
Re: UPLOAD with progess bar new!
by colin, 17 years, 3 months ago
Thank you for your contribution.Reply
Re: UPLOAD with progess bar new!
by kren, 17 years, 3 months ago
there is one thing i was not able to upload .pps file so i added to class.upload.php into allowed array...
$this->allowed = array(...)
this line
"application/vnd.ms-powerpoint",

cheersReply
Re: UPLOAD with progess bar new!
by colin, 17 years, 3 months ago
This will be included in the next 0.25 release, alongside some other MIME types for Office2007.Reply