How to store uploaded file into folder using CodeIgniter?

喜你入骨 提交于 2020-01-05 04:03:24

问题


How to store upload file into folder using CodeIgniter?


回答1:


Please Be sure with your gallery folder it must be in root alongside with application folder name gallery

$config['upload_path']='./gallery/';
$config['allowed_types']='gif|png|jpeg|jpg';
$config['max_size']='100';
$config['max_width']='1024';
$config['max_height']='700';
$this->upload->initialize($config);
$this->upload->do_upload('upload_photo');



回答2:


Hey try this code inc controller. This the function when u hit the upload button in your vie form..

function sendresume()
{

    $config['upload_path'] = 'C:\xampp\htdocs\upload\application'; //path where to save in the systme
    $config['allowed_types'] = 'doc|docx|pdf'; //file types to accept while uplaoding
    $config['max_size'] = '10240';  //size limit

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

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());

        $this->load->view('upload', $error);
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());

        echo "Resume Successfully uploaded to database.............";
        $file = $data['upload_data']['full_path'];  //upload file path
            }
   }


来源:https://stackoverflow.com/questions/13642384/how-to-store-uploaded-file-into-folder-using-codeigniter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!