代码适用于图像,但不适用于codeigniter中的其他文件

I successfully uploaded the image into the folder and its name to the database but same code does not upload the file in the folder but uploads the name in the database.Following is my code to upload the audio file to my folder musics.

Controller Function

public function add_audio(){

        $config['upload_path'] = './musics/';
        $config['allowed_types'] = 'mp3';
        $config['max_size'] = '100000000000000';

        $this->load->library('upload',$config);
        chmod('musics/', 0777);
        $this->upload->do_upload('output');

        $data['audio'] = $_FILES['output']['name'];
        $this->load->model('main');
        $query = $this->main->insert('audio',$data);            

        if($query = TRUE){

            $this->load->view('admin/success');
        }
        else{

            redirect($_SERVER['HTTP_REFERER']);
        }   //end else
    }   //end function

Try removing the 'output' from $this->upload->do_upload('output');

and try to replace your part of your code with this:

if ( ! $this->upload->do_upload())
{
    $data['error'] = $this->upload->display_errors();    
    //line of codes that displays if there are errors
}
else
{
    $data['audio'] = $_FILES['output']['name'];

    $this->load->model('main');
    $query = $this->main->insert('audio',$data);

    if($query == TRUE){
        $this->load->view('admin/success');
    }
}

In the above code you have specified

if($query = TRUE){
    $this->load->view('admin/success');
}

Since it's a comparison and not as assignment this should be corrected as

if($query == TRUE){
    $this->load->view('admin/success');
}

Check it by other file formats whether you are getting or not by:

print_r($_FILES);

and you are using = instead of == in if condition.

try this:

    if($query = TRUE){

             $this->load->view('admin/success');
    }