0
次の機能は、間違ったファイルタイプをアップロードしたとしても、PDFファイルを確実にアップロードしています。アップロード時にCodeigniterの問題が発生する(v2.1) - (間違ったファイルタイプ)
固定// output of the var_dump's
$this->upload->data() (array)
file_name brochure.pdf
file_type [empty string]
file_path D:/Shared/Web Sites/site-dev/documents/
full_path D:/Shared/Web Sites/site-dev/documents/brochure.pdf
raw_name brochure
orig_name [empty string]
client_name brochure.pdf
file_ext .pdf
file_size 369498
is_image FALSE
image_width [empty string]
image_height [empty string]
image_type [empty string]
image_size_str [empty string]
$data (array)
error
The filetype you are attempting to upload is not allowed.
function do_upload()
{
$config['upload_path'] = './documents/';
$config['allowed_types'] = 'pdf|doc';
$this->load->library('upload', $config);
if (! $this->upload->do_upload('File'))
{
$data = array('error' => $this->upload->display_errors());
var_dump($this->upload->data());
var_dump($data);exit;
//$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
//$this->load->view('upload_success', $data);
}
return $data;
}
あなたは(の$ this - > upload-> FILE_TYPE)をダンプし 'てみpleseはできます;' – safarov
が固定 - あり2.1のアップロードクラスの問題 アップロードライブラリを変更する際にここに記載されている手順に従っています:) クイックレスポンスありがとう:) http://stackoverflow.com/questions/7495407/uploading-in- codeigniter-file-type-you-are-attempting-to-upload-is-not- allo – Zabs
ok、Congratz =) – safarov