Skip to main content

Posts

Showing posts from June, 2023

MP4 upload is not working in codeigniter or PHP

 .MP4 upload is not working in codeigniter or PHP If any file format upload is not working in codeigniter or in any php framework and showing error like "file format is not allowed" then we need to first get the correct mime type and then need to allow it. In codeigniter first print the file mime type by using the below code if ( isset ( $_FILES [ 'file_name' ][ 'tmp_name' ])) { $filePath = $_FILES [ 'file_name' ][ 'tmp_name' ]; $finfo = finfo_open (FILEINFO_MIME_TYPE); $fileType = finfo_file ( $finfo , $filePath ); finfo_close ( $finfo ); echo "Uploaded file type: " . $fileType ; } then add the printed filetype in the config/mimes.php config/mimes.php 'mp4' => array ( 'video/mp4' , 'application/octet-stream','PUT_HERE' ), 'MP4' => 'video/mp4' , Thanks