Upload error - Codeigniter

Asked

Viewed 33 times

1

I am uploading a csv file, but it returns the invalid extension error even though the extension is released. I went to look for the cause of the error and found that it is because of a line that is in the file.

if (!$this->upload->do_upload()) {
        $this->session->set_flashdata('erro', $this->upload->display_errors());
        redirect(base_url() . 'updb/up_numeros/' . $tipo);
        exit;
    } 

Between the lines of the csv file there is one with the following text:

COLUNA 1              COLUNA 2
C TESTE - 6173        2

When I delete the row or include an empty space or any other character in column 1, the upload is successfully performed.

Does anyone have any idea where the mistake might be?

1 answer

0

Try to put the allowed_types.

Ex.:

    $configUpload['upload_path']   = $path;
    $configUpload['file_name']   = $descricao;
    $configUpload['allowed_types'] = 'jpg|png|gif|pdf|zip|rar|doc|xls';
    $this->upload->initialize($configUpload);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.