나는 이미 1 시간 30 분과 함께 싸우고 있지만 문제를 찾을 수 없습니다. 나는 CodeIgniter의 업로드 기능을 사용하고 있지만, 항상 업로드 실패 -codeigniter에 업로드 된 사진이 없습니다.
컨트롤러 -
// Uploads the picture to server
public function uploadPicture()
{
$this->load->helper(array('form', 'url'));
$this->load->helper('url');
$config['upload_path'] = './images/pictures/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '700';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$this->upload->do_upload();
if (! $this->upload->do_upload())
{
$data = array('upload_data' => $this->upload->data());
var_dump($data);
//redirect('/profile/changePicture', 'refresh');
}
else
{
redirect('/profile/changePicture', 'refresh');
}
}
보기 -
난을 선택하면 나도 어떤 사진을 선택하지 않거나 후<form class="fix-this form" method="post" action="/savieno/profile/uploadPicture" enctype="multipart/form-data">
<div class="formfield">
<label id="current-password-error" class="input-error" style="display: none;"></label>
<span class="profile">Tava bilde: </span>
<input id="picture" name="picture" class="with-label" style="width: 270px;" type="file" placeholder="Tava bilde" />
<label>*</label>
</div>
<input type="submit" id="submit" value="Labot Profilu" name="edit" class="fix-this" />
</form>
그림, 그것은 나에게 detials와 var_dump를 준다 -
array
'upload_data' =>
array
'file_name' => string '' (length=0)
'file_type' => string '' (length=0)
'file_path' => string './images/pictures/' (length=18)
'full_path' => string './images/pictures/' (length=18)
'raw_name' => string '' (length=0)
'orig_name' => string '' (length=0)
'client_name' => string '' (length=0)
'file_ext' => string '' (length=0)
'file_size' => string '' (length=0)
'is_image' => boolean false
'image_width' => string '' (length=0)
'image_height' => string '' (length=0)
'image_type' => string '' (length=0)
'image_size_str' => string '' (length=0)
무엇이 문제 일 수 있냐?
어떻게 실패 하는가? 무슨 일이야? 오류가 있습니까? – kba
아무런 오류가 없습니다. 그냥 var_dump를로드합니다 ... 컨트롤러를 확인하십시오. 업로드에 실패하면 var_dump를로드하고 그렇지 않으면 리디렉션합니다. ;/ –
'$ this-> upload-> do_upload()'를 두 번하고 있습니다. – kba