stvnthomas / CodeIgniter-Multi-Upload

Multiple file upload support for CodeIgniter 2.x.
151 stars 158 forks source link

Doesnt work #1

Closed lstables closed 11 years ago

lstables commented 11 years ago

YOu Library doesnt work I done what you said but dont you have to load the lib?

stvnthomas commented 11 years ago

Yes, you'd still need to load the upload library and configure it. The only difference between using this extension and the default codeigniter library is that you call do_multi_upload() instead of do_upload() to perform your upload. For example:

//Load upload library.
$this->load->library("upload");

//Initialize upload.
$this->upload->initialize(array(
    "allowed_types" => "gifjpg|png",
    "upload_path" => "/path/to/upload/directory/"
));

//Do multi-upload.
if($this->upload->do_multi_upload("file")){
    //Code executed upon successful upload.
}
lstables commented 11 years ago

or right so i can just perform the new upload instead then, what if there's only one upload would it revert backt o CI upload?

stvnthomas commented 11 years ago

If only one file upload is being performed, the multi-upload will fallback to the do_upload() method provided by codeigniter. You can see the check for multiple files and the fallback to the do_upload() method on lines 264-268 of MY_Upload.php.