Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Strange problem with file upload

$
0
0
Hello family. First I apologize if my english is not perfect, I translated automatically through google translate.
I have a strange problem. First I try to upload mp3 files using the codeigniter upload library. But it turns out that sometimes some files are sent while other files not. All the files I'm trying to send are of mp3 type and I do not think the problem comes from the size of the file. The error message is: The file type you are trying to send is not allowed. And Here is my controller:
PHP Code:
public function send_music(){
 
       $config = array(
 
'upload_path' => "./uploads/musiques/",
 
'allowed_types' => "mp3|ogg",
 
'max_size' => 20480,
 
'file_ext_tolower' => TRUE,
 
'encrypt_name' => TRUE,
 
'remove_spaces' => TRUE
 
);
 
$this->upload->initialize($config);
 if(
$this->upload->do_upload('mymusic')){
 
               echo $this->upload->data('file_name');
 }
 else{
 
               $error = array('error' => $this->upload->display_errors());
 
               foreach($error as  $key => $value){
 
               $this->alert->set('alert-danger'$key.' =>'.$value);
 
               }
 
               return $error;
 }
 
   

Viewing all articles
Browse latest Browse all 14114

Trending Articles