[eluser]Thiago Leao[/eluser]
please, i need to Multiple file upload.
I have code, with upload simple, that generates two images, one at 800x600 and another 100x75
Code:
<?php
class Upload extends Controller {
function go() {
if(isset($_POST['upload'])) {
$dia = date("Y-m");
$diretorio = 'assets/uploads/'.$dia.'/';
if(!is_dir($diretorio)){
mkdir($diretorio, 0777, TRUE);
chmod($diretorio, 0777);
}
$config['upload_path'] = $diretorio;
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$config['max_size'] = '8192'; // 8Mbs
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload();
$image_data = $this->upload->data();
$configLarge = array(
'source_image' => $image_data['full_path'],
'new_image' => $diretorio,
'master_dim' => 'auto',
'maintain_ratio' => true,
'width' => 800,
'height' => 600
);
$this->load->library('image_lib');
$this->image_lib->initialize($configLarge);
$this->image_lib->resize();
$this->image_lib->clear();
$configThumb = array(
'source_image' => $image_data['full_path'],
'new_image' => $diretorio.'/'.substr($image_data['file_name'], 0, -4).'_thumb.'.end(explode(".", $image_data['file_name'])),
'maintain_ratio' => true,
'master_dim' => 'auto',
'width' => 150,
'height' => 150
);
$this->image_lib->initialize($configThumb);
$this->image_lib->resize();
}
}
}
?>
could someone help me how to do Multiple upload, please?
thanks!