Search the web
Sign In
New User? Sign Up
codeigniter-id · Codeigniter Indonesia
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Bls: [codeigniter-id] Upload file ke beberapa folder   Message List  
Reply | Forward Message #3059 of 4180 |
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]




Mon Jun 29, 2009 4:04 pm

asmuri_anwar
Online Now Online Now
Send Email Send Email

Forward
Message #3059 of 4180 |
Expand Messages Author Sort by Date

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/',...
Asmuri Anwar
asmuri_anwar
Online Now Send Email
Jun 29, 2009
4:04 pm

Hallo salam kenal Pak Asmuri :) selamat datang di codeigniter-id. dan terima kasih atas solusinya. 2009/6/29 Asmuri Anwar <asmuri_anwar@...> ... -- Best...
fs
antoni_fajar
Offline Send Email
Jun 30, 2009
5:36 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help