Hi,
I am trying to extend the Upload library in CodeIgniter. I have been trying all morning, following various tuts and forum posts, but can't get it to work.
If I add the function I want directly into the Upload.php library, it works-- but I know this isn't the right way, and want to do it right since I'm doing it.
Here is the content of the extension [system/application/libraries/MY_Upload.php]:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Upload extends Upload{
function MY_Upload(){
parent::Upload();
}
function mupload($configs,$files){
if(count($configs) != count($files)){
return 'array_count_wrong';
}
$retArr=array();
for($i=0, $j = count($files);$i<$j;$i++){
$this->initialize($configs[$i]);
if(!$this->do_upload($files[$i])){
array_push($retArr,$this->display_errors());
}else{
array_push($retArr,'OK');
}
}
return($retArr);
}
?>
And relevant controller code:
$this->load->library('upload');
$messages=$this->upload->mupload($config,$files);
It fails with no indication of why.
What am I doing wrong?
Thx.