我正在使用codeigniter,我想将文件图片上传到我的文件夹,
路径为web/assets/picture/
。
我看过这里,无法用我找到的答案修复它。请帮忙。
我的观点在哪里输入图片:
echo form_open_multipart("adminFolder/admin/insert_picture");
echo form_upload("userfile", "Gambar Picture");
echo form_submit("input_picture", "Input now !!!");
我的控制器是insert_picture:
if($this->input->post("userfile")){
$this->model_get->doUpload();
$this->adminPic();
}else{
$this->insertPicture();
}
我的模特:
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();
}
答案 0 :(得分:0)
将upload_path设置为:
$config['upload_path'] = FCPATH . 'web/assets/picture/';
FCPATH
常量返回主目录的路径。
确保目录存在且可写。