vendredi 10 avril 2015

codeigniter how to upload picture to folder, web/assets/picture/

i am using codeigniter i want to upload a file picture to my folder, path is web/assets/picture/


ive look up here and cannot fix with the answer i found. please help.


this my view where to input the picture :



echo form_open_multipart("adminFolder/admin/insert_picture");
echo form_upload("userfile", "Gambar Picture");
echo form_submit("input_picture", "Input now !!!");


my controller the insert_picture :



if($this->input->post("userfile")){
$this->model_get->doUpload();

$this->adminPic();
}else{
$this->insertPicture();
}


my model :



function doUpload(){

$config['upload_path'] = '../assets/images/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '2048';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['overwrite'] = TRUE;

$this->load->library("upload", $config);
$this->upload->do_upload();

}

Aucun commentaire:

Enregistrer un commentaire