如何使用CodeIgniter的上传文件保存到文件夹?
Answer 1:
请确保你的库文件夹必须是根一起与应用程序文件夹的名称图库
$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');
Answer 2:
嘿,试试这个代码INC控制器。 这当u击中上传按钮,在你的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
}
}
文章来源: How to store uploaded file into folder using CodeIgniter?
标签:
codeigniter