Salam kenal dan saya baru di milis ini,
Mungkin script seperti di bawah ini bisa membantu...
$config['allowed_types'] = 'zip|gif|jpg|png';
if(eregi('image/', $_FILES['userfile']['type'])) :
    $config['upload_path'] = './public/image';
else :
    $config['upload_path'] = './public/attachment';
endif;
------------------------------------------------------------
Beta Online Store -- www.fadyashop.com
--- Pada Jum, 26/6/09, fs <antoni.fs@...> menulis:
Dari: fs <antoni.fs@...>
Topik: [codeigniter-id] Upload file ke beberapa folder
Kepada: codeigniter-id@yahoogroups.com
Tanggal: Jumat, 26 Juni, 2009, 11:10 AM
Dear All,
Mohon bantuannya, Gw ada masalah dengan upload beberapa file ke folder yang
berbeda.
Misalnya :
- upload file image.jpg ke folder => "./public/image/ ";
- dan file archieve.zip ke folder => ".public/attachemen t/";
gw coba config ke dua folder yang berbeda tapi kok masih saja terupload ke
config yg pertama.
contoh codenya spt ini.
function upload(){
$this->upload_ image();
$this->upload_ att();
}
function upload_image( ){
$config['upload_ path'] = './public/image' ;
$config['allowed_ types'] = 'gif|jpg|png' ;
$config['max_ size'] = '1000';
$config['max_ width'] = '1024';
$config['max_ height'] = '1000';
$this->load- >library( 'upload', $config);
if(!$this->upload- >do_upload( 'file_image' )){
$error = array('error' => $this->upload- >display_ errors()) ;
$this->session- >set_flashdata( 'msg',$error) ;
$data['file_ image'] = '';
}else{
$res = $this->upload- >data();
$data['file_ image'] = $res["file_name" ];
}
return $data['file_ image'];
}
function upload_image( ){
$config['upload_ path'] = './public/image' ;
$config['allowed_ types'] = 'gif|jpg|png' ;
$config['max_ size'] = '1000';
$config['max_ width'] = '1024';
$config['max_ height'] = '1000';
$this->load- >library( 'upload', $config);
if(!$this->upload- >do_upload( 'file_att' )){
$error = array('error' => $this->upload- >display_ errors()) ;
$this->session- >set_flashdata( 'msg',$error) ;
$data['file_ template' ] = '';
}else{
$res = $this->upload- >data();
$data['file_ att'] = $res["file_name" ];
}
return $data['file_ att'];
}
atas segala saran dan bantuannya gw sampaikan terima kasih.
--
Best Regards,
Antoni Fs
[Non-text portions of this message have been removed]
Yahoo! Mail Kini Lebih Cepat dan Lebih Bersih. Rasakan bedanya sekarang!
http://id.mail.yahoo.com
[Non-text portions of this message have been removed]