0
private function _upload_video() {
    $prev_image = $this->input->post('prev_video');
    $image = $_FILES['video']['name'];
    $image_type = $_FILES['video']['type'];
    $return_image = '';

    if ($image != "") {
        if ($image_type == 'video/mp4') {
            $destination = 'assets/uploads/gallery/';
            $file_type = explode(".", $image);
            $extension = strtolower($file_type[count($file_type) - 1]);
            $image_path = $this->input->post('gallery_id').'-video-' . time() . '-sms.' . $extension;
            move_uploaded_file($_FILES['video']['tmp_name'], $destination . $image_path);

            // need to unlink previous image
            if ($prev_image != "") {
                if (file_exists($destination . $prev_image)) {
                    @unlink($destination . $prev_image);
                }
            }
            $return_image = $image_path;
        }
    } else {
        //echo "image empty";
        //exit;
        $return_image = $prev_image;
    }
    return $return_image;
}

I have created this function for uploading video in my project. In the localhost, everything works fine but when I push code to live server, this code doesn't work. If I echo $_FILES['video']['type']; this line it return nothing in live server, so code not moves to the if block.

But everything works fine in my localhost server problem only in the live server.

Can anyone guide me to solve the problem.

kirb
  • 369
  • 4
  • 9
  • have you tried check folder permission (write permission) on live server? – kirb May 28 '20 at 06:29
  • 2
    "_The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted._" Maybe use [mime_content_type](https://www.php.net/manual/en/function.mime-content-type.php) – brombeer May 28 '20 at 06:32
  • Yes folder permission is 777. in the same folder images are also uploading but issue is in only video files – US Staffing May 28 '20 at 06:32

0 Answers0