Welcome Guest, Not a member yet? Register   Sign In
Upload class - allowed filetype issue
#1

[eluser]Zeff[/eluser]
Hi all,

I made a simple upload form for upload rtf files to a congress website:
Code:
// Set upload config
$config['upload_path'] = '/www/_shares/_mycongress/abstracts/';
$config['allowed_types'] = 'rtf';
$config['max_size'] = '10000';
            
$this->load->library('upload', $config);

// Check the upload
if($this->upload->do_upload('abstract'))
{
    $data['upload_data'] = $this->upload->data();
}
else
{
    $data['upload_data'] = $this->upload->data();
    $data['error'] = $this->upload->display_errors();
}

var_export($data);

But uploading doesn't work, I get the following error out of the var_export($data):
Code:
The filetype you are attempting to upload is not allowed

When I change allowed filetypes like this:
Code:
$config['allowed_types'] =  '*';

the upload works... (So path and permissions of upload directory are correct)

What goes wrong?

Thanks in advance for the help!

Zeff
#2

[eluser]Zeff[/eluser]
BTW, some further debugging reveals that the RTF uploaded file has a 'file_type' => 'application/msword',
but when I look in config > mimes file, I see 'rtf' => 'text/rtf' as existing mime...
The $mime var in line 620 return no array but FALSE...
#3

[eluser]Zeff[/eluser]
Found the solution! Problems with mime type detection have been fixed: I downloaded the most recent Upload library from Github (https://github.com/EllisLab/CodeIgniter/...Upload.php) and the problem was solved!

I love this Framework!




Theme © iAndrew 2016 - Forum software by © MyBB