私はcodeigniterアプリを持っていて、ページに行くたびにアップロードするファイルを選択していないと表示されます。私はファイルハンドルのアップロードとしてページ表示に同じcodeigniter関数を使用しています。ページに初めてアップロードするファイルを選択していませんでした
if(!$this->upload->do_upload('userFile')) { // if there are errors uploading the file of if it's the first time on the page…
$content_data['album'] = $album;
echo "post go through?";
// if the $_POST array is not empty display the error. That means that someone submitted the form without choosing a file
//if(isset($_POST['submit'])) {
$content_data['error'] = array('error' => $this->upload->display_errors());
//}
$content_data['data'] = array('upload_data'=>$this->upload->data());
$data['sess'] = $this->session;
$data['content'] = $this->load->view('member/addPhoto', $content_data, true);
$this->load->view('template/admin', $data);
} else { // else there were no errors and we can resize and upload.
}
明白な質問は、ファイルアップロードを処理するのと同じ機能をページ表示に使用している理由です。私たちが気付いていない制約がありますか?別々の機能で処理する必要があるように聞こえますが、これは問題を解決する最も明白な方法です。 –
フォームの検証で同じ関数を使用するのがベストプラクティスなので、ファイルのアップロードは類似しているとわかりました....しかし今、あなたは私の考えを得ました。 – Catfish