Trying to upload mp3s via a form using Codeignitor framework. My allowed types are mp3|wav. Wav files upload fine. Mp3s do not upload. Some people with this problem have added more meme types to memes.php. I have tried this to no avail.
Here is my controller code (again, works fine with wavs)
$this->load->model('songshare/Songmodel');
$this->Songmodel->songupload($data);
//upload data
$config['upload_path'] = realpath(APPPATH.'../uploads/');
$config['max_size'] = '0';
$config['allowed_types'] = 'mp3|wav';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile')) {
$data = array('msg' => $this->upload->display_errors());
} else { //else, set the success message
$data = array('upload_data' => $this->upload->data());
$field = 'userfile';
var_dump($_FILES[$field]['type']);
}
If I upload a mp3 and have the vardump in the IF, it returns - string '' (length=0)
If I upload a wav and have the vardump in the ELSE, it returns - string 'audio/x-wav' (length=11)
I am stumped quite frankly. Any idea what is going on here?
Thanks!
The problem was I had not increased the file size to large enough. Changed max file size allow in php.ini.