0

I tried to add the audio file into the folder and its name to database but file doesnot upload into the folder but it is added into the database.Following is my Controller:

public function add_audio(){


            $config['upload_path'] = './songs/';
            $config['allowed_types'] = 'mp3|3gp|mpeg|mp4';

            $this->load->library('upload',$config);
            $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

my folder name is songs.and database name is audio.Database is uploading the audio name but not the folder..so please help

1 Answers1

0

You need to set permission 777 to your upload directory. go to your root directory first and then use below command:

chmod 0777 songs/

check this to know more to change folder permission.

Community
  • 1
  • 1
Asif Rahaman
  • 775
  • 6
  • 10
  • i didn't set the permission level for the image it works fine but do i have to set permission level to audio files? – sudeep acharya Jul 26 '16 at 12:25
  • you provide me the code but where to paste it.....please help...i am running windows and xampp as my server – sudeep acharya Jul 26 '16 at 13:39
  • @sudeepacharya it was actually a command to run on terminal....if it worked for image then it should work for songs folder too! try debugging... If you want code then try putting `chmod('songs/', 0777);` this line before your `$this->upload->do_upload()` – Asif Rahaman Jul 27 '16 at 02:43