Karmveer
Karmveer

Reputation: 11

How i can upload more than 50MB mp4 videos in codeigniter?

Am using below code, I have added a maximum size, but it uploads only 1 or 2 mb videos, if i upload a 55 MB video, it takes long to process but shows a result as blank page:

 if (isset($_FILES['video']['name']) && $_FILES['video']['name'] != '') {
            unset($config);
            $date = date("ymd");
            $configVideo['upload_path'] = './videos';
            $configVideo['max_size'] = '602400000';
            $configVideo['allowed_types'] = 'mp4|avi|flv|wmv|';
            $configVideo['overwrite'] = FALSE;
            $configVideo['remove_spaces'] = TRUE;
            $video_name = $date.$_FILES['video']['name'];
            $configVideo['file_name'] = $video_name;

            $this->load->library('upload', $configVideo);
            $this->upload->initialize($configVideo);
            if (!$this->upload->do_upload('video')) {
                echo $this->upload->display_errors();
            } else {
                $videoDetails = $this->upload->data();

             $schdate = $this->input->post('scheduledate');

                $schdesc = $this->input->post('scheduledes');

                $user = '1';

                $data = array(

                    'name' =>$configVideo['file_name'],

                    'date' => $schdate,

                    'description' => $schdesc,

                   'user_id' => $user

                );

  $this->db->insert('ch_schedule', $data);

                echo "Successfully Uploaded";
            }
        }

Upvotes: 1

Views: 5663

Answers (5)

Rohit Gaidhane
Rohit Gaidhane

Reputation: 351

enter image description here

As you see in the attached screenshot, just go to php setting page and change post_max_size to what you want.

Upvotes: 0

jonm
jonm

Reputation: 131

Using conventional uploading system to upload large video files is not an efficient option . Use ftp to upload large video files .Create a FTP on your cpanel.

Upvotes: 0

Brandon Jake Sullano
Brandon Jake Sullano

Reputation: 335

if your machine is the server all people that will access and upload large file can do that if you will change your max file upload in you php ini

here is the link for you php.ini file

https://www.ostraining.com/blog/coding/phpini-file/

Make sure to restart your Apache after amending your php.ini file

Upvotes: 1

Sulthan Allaudeen
Sulthan Allaudeen

Reputation: 11310

You just need to set your preferences in your Codeigniter

    $config['upload_path'] = './uploads/';  # This is the upload destination directory
    $config['allowed_types'] = 'mp4'; #These are the allowed file types
    $config['max_size'] = '100'; #This is the max size allowed

Follow this Official Guide of Codeigniter

Note :

Also check your upload_max_filesize and post_max_size in your php.ini. If you just make this change don't forget stop and start or restart your apache.

Update :

If you are working online and can't able to change the php.ini

Have the following code in your controller

ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');                               
ini_set('max_input_time', 3000);                                
ini_set('max_execution_time', 3000);

Upvotes: 2

Yes Kay Selva
Yes Kay Selva

Reputation: 584

Check your upload_max_filesize and post_max_size in your php.ini

Upvotes: 1

Related Questions