CodeIgniter Avatare werden hochgeladen

Hier ist das neue HTML:

<input type="file" name="file_1" />
<input type="text" name="image_description_1" class="text-input"/>

Hier ist die neue Funktion _submit:

if($this->CI->input->post('file_1')){
$config['overwrite'] = TRUE;
$config['allowed_types'] = 'jpg|jpeg|gif|png';
$config['max_size'] = 2000;
$config['upload_path'] = realpath(APPPATH . '../assets/uploads/avatars');

$this->CI->load->library('upload', $config);
$this->CI->upload->do_upload();

$image_data = $this->CI->upload->data();

$image['description'] = $this->CI->input->post('image_description_1');
$image['user_id'] = $id;
$image['image'] = $image_data['file_name'];

$this->CI->db->insert('report_images',$image);

}

Die Beschreibung und die Benutzer-ID werden korrekt übermittelt, aber die Datei geht verloren.

Sollte ich etwas anderes machen? Ich bin mir nicht sicher, was los ist.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage