我根据“$this->upload->data()”消息成功上传了文件。但是,该文件不会显示在 D:/Drive/webcode/uploads 文件夹中。任何人都可以帮忙吗?谢谢你。***move_uploaded_file() 有效,但 do_upload [Codeigniter 3] 无效
查看(upload_form.php)
<form method="post" enctype="multipart/form-data">
<input type="file" name="userfile">
<input type="submit" name="submit">
</form>
控制器(上传)
function __construct()
{
parent::__construct();
$this->load->helper('form');
$this->load->helper('url');
}
public function jobapply()
{
//Show view form
$this->load->view('upload_form');
if($this->input->post('submit')){ //Check submit button
//Confirm file is transfered here
echo basename($_FILES["userfile"]["name"]).'<br>';
//Upload Process
$config['upload_path'] = './upload/';
$this->load->library('upload', $config);
$this->upload->do_upload('userfile');
var_dump(is_dir($config['upload_path'])); //Check if this path exist
//return the uploaded data after executing do_upload()
echo "<br><pre>";
print_r($this->upload->data());
echo "</pre>";
}
}
输出
1969.png
bool(true)
Array
(
[file_name] => 1969.png
[file_type] => image/png
[file_path] => D:/Drive/webcode/uploads/
[full_path] => D:/Drive/webcode/uploads/1969.png
[raw_name] => 1969
[orig_name] =>
[client_name] => 1969.png
[file_ext] => .png
[file_size] => 1217976
[is_image] => 1
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] =>
)
繁星点点滴滴
慕哥9229398