我正在使用 blueimp jQuery 文件上传作为文件上传器。这是我的控制器代码。
public function savedocument() {
$response = array('status' => 'failed', 'message' => 'Unknown reason');
$config = array();
$config['upload_path'] = 'upload path';
$config['allowed_types'] = 'gif|jpg|png|pdf|doc|docx';
$config['max_size'] = '20480';
$config['overwrite'] = FALSE;
//var_dump($config);
$this->load->library('upload', $config);
$files = $_FILES;
for($i=0; $i< count($_FILES['files']['name']); $i++)
{
$_FILES['files']['name']= $files['files']['name'][$i];
$_FILES['files']['type']= $files['files']['type'][$i];
$_FILES['files']['tmp_name']= $files['files']['tmp_name'][$i];
$_FILES['files']['error']= $files['files']['error'][$i];
$_FILES['files']['size']= $files['files']['size'][$i];
$this->upload->initialize($config);
if (!$this->upload->do_upload('files')) {
$response['message'] = $this->upload->display_errors();
} else {
$file_details = $this->upload->do_upload('files');
$response['status'] = 'success';
$response['message'] = $file_details;
}
}
}
我得到打印 $file_details 的值为 bool(true)。上传的文件名(即上传库分配的名称)不起作用。我想获取这些详细信息。如何获取它?如果有人知道请帮助。
qq_笑_17