Загрузка видео для проекта codeigniter

1

Я не могу загрузить видео с этим контроллером, хотя я написал аналогичные типы контроллеров, которые успешно загружают фотографии, но я не могу загрузить видео. здесь прикрепить файл контроллера: -

        public function trail_itinerary($id = null)
    {
        if($this->userlib->isLoggedIn())
        {
            $error_no['trail_id1'] = $id;
            $user_id = $this->userlib->getId();
            $itinerary = $this->input->post('itinerary');
            $highlights = $this->input->post('highlights');
            $hotel_name = $this->input->post('hotel_name');
            $stay_description = $this->input->post('stay_description');
            $hotel_star_cat = $this->input->post('hotel_star_cat');
            $destination = $this->input->post('destination');
            $nights = $this->input->post('nights');
            $inclusions = $this->input->post('inclusions');
            $exclusions = $this->input->post('exclusions');
            $terms_conditions = $this->input->post('terms_conditions');
            $cancellation_policy = $this->input->post('cancellation_policy');

            //$upload_videos = picture of videos

            $email = $this->userlib->getEmail();

            $structure = 'application/views/upload/'.$email.'/'.$id;
            if(is_dir($structure))
            {
                $config['upload_path'] = $structure;
            }
            else
            {
                mkdir($structure);
                $config['upload_path'] = $structure;
            }   

            $config['allowed_types'] = 'gif|jpg|jpeg|png|doc|docx|ppt|pptx|pdf|txt|avi|mpeg|mp3|mp4|3gp';
            $config['max_size'] = '40000000';
            $this->load->library('upload', $config);
            $this->upload->initialize($config);

            $data['upload_data'] = '';
            if (!$this->upload->do_upload('upload_videos'))
            {
                $data = array('msg' => $this->upload->display_errors());
            }
            else
            {   
                $data = array('msg' => "Upload success!");
                $data = $this->upload->data();
                $upload_videos = $data['file_name'];
            }

            $this->form_validation->set_rules('itinerary', 'Itinerary', 'trim|required');
            $this->form_validation->set_rules('highlights', 'Highlights', 'trim|required');
            $this->form_validation->set_rules('hotel_name', 'Hotel Name', 'trim|required');
            $this->form_validation->set_rules('stay_description', 'Stay Description', 'trim|required');
            $this->form_validation->set_rules('hotel_star_cat', 'Hotel Star Category', 'trim|required');
            $this->form_validation->set_rules('destination', 'Hotel Location', 'trim|required');
            $this->form_validation->set_rules('nights', 'Nights at hotel', 'trim|required');
            $this->form_validation->set_rules('inclusions', 'Inclusions', 'trim|required');
            $this->form_validation->set_rules('exclusions', 'Exclusions', 'trim|required');
            $this->form_validation->set_rules('terms_conditions', 'Terms & Conditions', 'trim|required');
            $this->form_validation->set_rules('cancellation_policy', 'Cancellation Policy', 'trim|required');

            if($this->form_validation->run() == FALSE)
            {
                $this->load->view('trail_itinerary',$error_no);
            }
            else
            {
                $data3['trail_id2']=$this->seller_store_model->trail_itinerary($user_id, $id, $itinerary, $highlights, $hotel_name, $stay_description, $hotel_star_cat, $destination, $nights, $inclusions, $exclusions, $terms_conditions, $cancellation_policy);
                if($this->input->post('review')=="Review")
                {
                    $this->load->view('edit_trail_basic_info', $data3);
                }
                elseif($this->input->post('submit')=="Submit")
                {
                    redirect('/seller_store');  //later on remove the functionality
                } //else unsetting of the data
            }
        }   
        else
        {
            echo "User not authorised";
        }
    }

Я уже внес необходимые изменения в файл config/mimes.php и php.ini.

Теги:
codeigniter

1 ответ

0
Лучший ответ

В config/mimes.php

Добавь это

'mp4' => array('video/mp4', 'application/octet-stream'),

default будет 'video/mp4'. Добавьте эту часть также 'application/octet-stream'

  • 0
    рад помочь :)
  • 0
    это сработало, спасибо @Abdulla
Показать ещё 1 комментарий

Ещё вопросы

Сообщество Overcoder
Наверх
Меню