我正在使用 php codeigniter 框架,并尝试上传文件夹中的图像并在配置文件视图中显示,但这是我上传文件时得到的结果:-
Array (
[upload_path] => ./community/photos/
[allowed_types] => jpeg|jpg|png
[max_size] => 100
[max_width] => 1024
[max_height] => 768
[overwrite] => 1
[file_name] => 1600052487_Musical-Birthday-Candle-Magic-Lotus-Flower-Candles-Blossom-Rotating-Spin-Party-Candle-14Small-Candles-2layers-Cake.jpg
)
上传路径似乎无效。
profile.php 控制器
public function do_upload()
{
echo "<pre>";
//print_r($_FILES);
//die;
if(!empty($_FILES['filename']['name'])){
$config['upload_path'] = FCPATH.'application/';
$config['allowed_types'] = 'jpeg|jpg|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$config['overwrite'] = true;
$config['file_name'] = time().'_'.$_FILES['filename']['name'];
print_r($config);
//echo var_dump(is_dir(FCPATH.'uploads/'));
//die;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('filename'))
{
//echo "sdfs";
print_r($this->upload->display_errors());
die;
// $error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata ('success','Invalid Credentils');
redirect('myProfile');
// $this->load->view('admin/profile/index', $error);
}
else
{
echo "xcvcx";
die;
$data = array('user_profile' => $this->upload->data());
$this->load->view('admin/profile/index', $data);
}
}else{
echo "dfgfd";
}
}
料青山看我应如是
撒科打诨
噜噜哒
慕姐4208626