1

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

4

2 回答 2

0

嘿试试这个代码公司控制器。这是当你在你的 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
            }
   }
于 2012-11-30T09:39:42.587 回答
0

请确保您的画廊文件夹必须与应用程序文件夹名称画廊一起位于根目录中

$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');
于 2012-11-30T10:02:33.477 回答