Welcome Guest, Not a member yet? Register   Sign In
Strange problem with file upload
#1

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;
 }
 
   
Simplicity is the ultimate sophistication
Reply


Messages In This Thread
Strange problem with file upload - by LEBOSSS - 02-19-2018, 04:37 PM
RE: Strange problem with file upload - by LEBOSSS - 02-19-2018, 05:15 PM
RE: Strange problem with file upload - by LEBOSSS - 02-19-2018, 06:47 PM
RE: Strange problem with file upload - by LEBOSSS - 02-19-2018, 07:34 PM
RE: Strange problem with file upload - by LEBOSSS - 02-20-2018, 07:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB