如何使用CodeIgniter将上传的文件存储到文件夹中?

如何使用CodeIgniter将上传的文件存储到文件夹中?,codeigniter,Codeigniter,如何使用CodeIgniter将上传文件存储到文件夹中 嘿,试试这个代码。这是当你点击vie表单中的上传按钮时的功能 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 a

如何使用CodeIgniter将上传文件存储到文件夹中

嘿,试试这个代码。这是当你点击vie表单中的上传按钮时的功能

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
            }
   }

请确保您的gallery文件夹必须与应用程序文件夹名称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');

你试过什么?您可以参考本文。您需要在$config['upload\u path']='your path'中定义上载路径