Предупреждение: mime_content_type (): пустое имя файла или путь - PullRequest
0 голосов
/ 08 апреля 2020

Народ,

Я создал форму, в которую вы загружаете файл изображения и видеофайл. Форма должна проверить, передаются ли правильные форматы файлов или нет, и находятся ли размеры файлов в пределах или нет. Это все.

Я получаю эту ошибку: «Предупреждение: mime_content_type (): пустое имя файла или путь в C: \ xampp \ htdocs \ test \ 02-04-2020 \ upload_test. php в строка 100 "

Код строки 100:

    if(!in_array(mime_content_type($video_file_tmp),$video_mime_type))

ПРИМЕЧАНИЕ. Я проверял файл tmp выше. Должен ли я делать это или проверять фактическое имя файла? Говоря об этом:

$video_file_name = $_FILES["id_verification_video_file"]["name"]; 
$video_file_tmp = $_FILES["id_verification_video_file"]["tmp_name"];

Контекст

    if(!in_array(mime_content_type($video_file_tmp),$video_mime_type)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 3b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    } 

И я получаю следующие пользовательские ошибки:

ОШИБКА 2a: Неверный файл! Разрешены только файлы изображений JPG, JPEG, PNG и GIF!

ОШИБКА 3b: Неверный файл! Разрешены только видеофайлы MP4, WAV, OGG, FLV, WMV и AVI!

Они относятся к следующим строкам:

1.

    if(!in_array(pathinfo($img_file_tmp,     PATHINFO_EXTENSION),$img_allowed_ext)) 
        { 
            $error_msg['img_error']= '<p class="text-    danger">ERROR STATEMENT 2a: Invalid File! Only JPG, JPEG, PNG and     GIF image files are allowed!'; 
            $error = 1; 
        } 

2.

           if(!in_array(mime_content_type($video_file_tmp),$video_mime_type)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 3b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    }  

ПРИМЕЧАНИЕ СНОВА: Я проверял файл tmp выше. Должен ли я делать это или проверять фактическое имя файла?

Если я смогу узнать, почему я получаю эту первую ОШИБКУ ПРЕДУПРЕЖДЕНИЯ, тогда другие 2 пользовательских ошибки исчезнут. Что означает это ПРЕДУПРЕЖДЕНИЕ и почему я его получаю? Я проверял допустимые расширения файлов в отношении файлов tmp. Следите за этим в моем коде.

Полный код

    <?php 

    $error_msg =  array(); 
    $success_msg =  array(); 

    $img_allowed_ext = array('gif','jpeg','jpg','png'); 
    $video_allowed_ext =           array('mp4','wav','wmv','avi','flv','ogg');  

    $img_mime_type =  array('image/gif','image/jpeg','image        /jpg','image/png'); 
    $video_mime_type =  array('video/mp4','video/wav','video        /wmv','video/avi','video/flv','video/ogg'); 


    if($_SERVER["REQUEST_METHOD"] == "POST") 
    { 
$error = 0 ; 
//var_dump($_Files); //For debugging. 

//Check whether the file was uploaded or not without any errors. 
if(!isset($_FILES["id_verification_video_file"]) || !isset($_FILES['id_verification_img_file'])) 
{ 
    $error_msg['all_fields'] =  '<p class="text-danger">ERROR STATEMENT 1: Select all fields that have asterisks besides them!</p>'; 
    $error = 1;             
} 
else 
{ 
    //Image Files 
    $img_file_name = $_FILES["id_verification_img_file"]["name"]; 
    $img_file_tmp = $_FILES["id_verification_img_file"]["tmp_name"];
    $img_file_type = $_FILES["id_verification_img_file"]["type"]; 
    $img_file_size = $_FILES["id_verification_img_file"]["size"]; 
    $img_file_error = $_FILES['id_verification_img_file']['error']; 

    $img_file_ext = pathinfo($img_file_name, PATHINFO_EXTENSION); 
    //$img_file_ext = pathinfo($img_file_tmp, PATHINFO_EXTENSION); //WRONGLY SAVES FILE NAMES WITH .tmp!

    //Video Files 
    $video_file_name = $_FILES["id_verification_video_file"]["name"]; 
    $video_file_tmp = $_FILES["id_verification_video_file"]["tmp_name"]; 
    $video_file_type = $_FILES["id_verification_video_file"]["type"]; 
    $video_file_size = $_FILES["id_verification_video_file"]["size"]; 
    $video_file_error = $_FILES['id_verification_video_file']['error']; 

    $video_file_ext = pathinfo($video_file_name, PATHINFO_EXTENSION); 
    //$video_file_ext = pathinfo($video_file_tmp, PATHINFO_EXTENSION); //WRONGLY SAVES FILE NAMES WITH .tmp!

    //Checking File Type.           
    //Checking File Type using pathinfo_extension() Function. 

    /*
    if(!in_array(pathinfo($img_file_name, PATHINFO_EXTENSION),$img_allowed_ext)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 2a: Invalid File! Only JPG, JPEG, PNG and GIF image files are allowed!'; 
        $error = 1; 
    } 
    */          
    //The error statement gets echoed even after selecting right type of file! 
    if(!in_array(pathinfo($img_file_tmp, PATHINFO_EXTENSION),$img_allowed_ext)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 2a: Invalid File! Only JPG, JPEG, PNG and GIF image files are allowed!'; 
        $error = 1; 
    }           

    /*
    if(!in_array(pathinfo($video_file_name, PATHINFO_EXTENSION),$video_allowed_ext)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 2b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    }           
    */
    //The error statement gets echoed even after selecting right type of file! 
    if(!in_array(pathinfo($video_file_tmp, PATHINFO_EXTENSION),$video_allowed_ext)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 2b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    }           


    //Checking File Type. 
    //Checking Mime Type using mime_content_type() Function. 

    /*
    if(!in_array(mime_content_type($img_file_name),$img_mime_type)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 3a: Invalid File! Only JPG, JPEG, PNG and GIF image files are allowed!'; 
        $error = 1; 
    } 
    */
    if(!in_array(mime_content_type($img_file_tmp),$img_mime_type)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 3a: Invalid File! Only JPG, JPEG, PNG and GIF image files are allowed!'; 
        $error = 1; 
    } 

    /*
    if(!in_array(mime_content_type($video_file_name),$video_mime_type)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 3b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    } 
    */          
    if(!in_array(mime_content_type($video_file_tmp),$video_mime_type)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 3b: Invalid File! Only MP4, WAV, OGG, FLV, WMV and AVI video files are allowed!'; 
        $error = 1; 
    } 

    //Checking File Sizes using filesize() function. 
    //5MB Image Size Allowed. 
    if(filesize($img_file_tmp) > 5000000) 
    { 
        $error_msg['img_file_size_err'] = '<p class="text-danger">ERROR STATEMENT 4a: File Size is greater than 5MB. File Size should not exceed the 100MB limit!'; 
        $error = 1; 
    } 
    //10MB Video Size Allowed.          
    if(filesize($video_file_tmp) > 10000000) 
    { 
        $error_msg['video_file_size_err'] = '<p class="text-danger">ERROR STATEMENT 4b: File Size is greater than 10MB. File Size should not exceed the 100MB limit!';  
        $error = 1; 
    }           

    //Checking for NO errors to proceed with the script flow. 
    if($error == 0)
    { 
        $user = $user; //Account Username here. 
        //$db_user = 'followingbrowser_user'; //Database username here. Has to be in quotes. 
        $db_user = 'root'; //Database username here. Has to be in quotes. 
        //Feed Id Verification Video & Image File Upload Directory path. 
        $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
        $default_directory_path_and_user_dir = "$default_directory_path"."/".$user; //Permanent Storage Directory Path for $user Folder. 

        //Create $user Folder in Permanent Storage Directory Path: 'uploads/videos/id_verifications' Folder.                
        if(!is_dir($default_directory_path_and_user_dir)) 
        {               
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($default_directory_path_and_user_dir,$mode,TRUE); //This line is working and is correct even without quoting "$mode". Requinix sugegsted to quote "$mode". 
        } 

       //Making Directories of every Files Types for Respective User.               
        $user_img_directory = "$default_directory_path_and_user_dir"."/"."imgs"; 
        $user_video_directory = "$default_directory_path_and_user_dir"."/"."videos"; 

        if(!is_dir($user_img_directory)) 
        { 
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($user_img_directory,$mode,TRUE); //This line is correct and working even without quoting $mode.
        } 

        if(!is_dir($user_video_directory)) 
        { 
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($user_video_directory,$mode,TRUE); //This line is correct and working even without quoting $mode. 
        }               

        //User Files Directories. 
        $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
        $default_directory_path_and_user_dir = "$default_directory_path"."/"."$user"; //Permanent Storage Directory Path for $user Folder. 
        $user_img_directory = "$default_directory_path_and_user_dir"."/"."img"; 
        $user_video_directory = "$default_directory_path_and_user_dir"."/"."videos"; 
        $user_id_img_file = "$user_img_directory"."/"."$img_file_name"."$img_file_ext"; 
        $user_id_video_file = "$user_video_directory"."/"."$video_file_name"."$video_file_ext"; 

        //Uploading the Files. 
        $upload_err =  0; 

        //Uploading Image File 
        if(file_exists("$user_img_directory/$user.gif")) 
        { 
            $error_msg['upload_img_error'] = '<p class="text-danger">ERROR STATEMENT 5d: You have already uploaded an Image File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_img_directory/$user.jpeg")) 
        { 
            $error_msg['upload_img_error'] = '<p class="text-danger">ERROR STATEMENT 5a: You have already uploaded an Image File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_img_directory/$user.jpg")) 
        { 
            $error_msg['upload_img_error'] = '<p class="text-danger">ERROR STATEMENT 5b: You have already uploaded an Image File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_img_directory/$user.png")) 
        { 
            $error_msg['upload_img_error'] = '<p class="text-danger">ERROR STATEMENT 5c: You have already uploaded an Image File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</p>'; 
            $upload_err = 1; 
        } 

        //Uploading Video File 
        if(file_exists("$user_video_directory/$user.mp4")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5e: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_video_directory/$user.wav")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5f: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 
        if(file_exists("$user_video_directory/$user.wmv")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5e: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_video_directory/$user.flv")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5f: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 
        elseif(file_exists("$user_video_directory/$user.ogg")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5f: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 

        //Checking for NO errors to proceed with the script flow. 
        if($upload_err == 0) 
        { 
            //DIRECTORY PATHS AGAIN
            //1. $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
            //2. $default_directory_path_and_user_dir = "$default_directory_path"."/".$user; //Permanent Storage Directory Path for $user Folder. 
            //3. $user_img_directory = $default_directory_path_and_user_dir."."/".img'; 
            //4. $user_video_directory = $default_directory_path_and_user_dir."."/".videos';

            if(is_uploaded_file($img_file_tmp) && is_uploaded_file($video_file_tmp)) 
            { 
                if(move_uploaded_file($img_file_tmp,$user_id_img_file)) 
                { 
                    rename($user_id_img_file,$user_img_directory.$user.'.'.$img_file_ext); 
                } 

                if(move_uploaded_file($video_file_tmp,$user_id_video_file)) 
                { 
                    rename($user_id_video_file,$user_video_directory.$user.'.'.$video_file_ext); 
                } 

                $success_msg['all_uploads'] = 'SUCCESS STATEMENT 6a: Both Image and Video files have been uploaded successfully!'; 
            } 
            else 
            {        
                $error_msg['all_uploads'] = 'ERROR STATEMENT 6b: Both Image and Video files failed to upload successfully! You may try again another time!'; 
                exit(); 
            } 
        } 
    }
}
}
?> 

4 апреля 2020 ОБНОВЛЕНИЕ: Люди,

Я обновил скрипт, но не повезло. Проблема остается. Я получаю следующие ошибки:

Предупреждение: mime_content_type (loudgob.png): не удалось открыть поток: нет такого файла или каталога в C: \ xampp \ htdocs \ test \ 02-04-2020 \ upload_test. php в строке 57

    Warning: mime_content_type(loudgob.mp4): failed to open stream: No such file or directory in C:\xampp\htdocs\test\02-04-2020\upload_test.php on line 63

    Warning: filesize(): stat failed for loudgob.png in C:\xampp\htdocs\test\02-04-2020\upload_test.php on line 72

    Warning: filesize(): stat failed for loudgob.mp4 in C:\xampp\htdocs\test\02-04-2020\upload_test.php on line 78

Полное обновление:

<?php 

    $error_msg =  array(); 
    $success_msg =  array(); 

    $img_allowed_ext = array('png'); 
    $video_allowed_ext = array('mp4');  

    $img_mime_type =  array('image/png'); 
    $video_mime_type =  array('video/mp4'); 

    if($_SERVER["REQUEST_METHOD"] == "POST") 
    { 
        $error = 0 ; 
        //var_dump($_Files); //For debugging. 

//Check whether the file was uploaded or not without any errors. 
if(!isset($_FILES["id_verification_video_file"]) || !isset($_FILES['id_verification_img_file'])) 
{ 
    $error_msg['all_fields'] =  '<p class="text-danger">ERROR STATEMENT 1: Select all fields that have asterisks besides them!</p>'; 
    $error = 1;             
} 
else 
{ 
    //Image Files 
    $img_file_name = $_FILES["id_verification_img_file"]["name"]; 
    $img_file_tmp = $_FILES["id_verification_img_file"]["tmp_name"];
    $img_file_type = $_FILES["id_verification_img_file"]["type"]; 
    $img_file_size = $_FILES["id_verification_img_file"]["size"]; 
    $img_file_error = $_FILES['id_verification_img_file']['error']; 

    $img_file_ext = pathinfo($img_file_name, PATHINFO_EXTENSION); 

    //Video Files 
    $video_file_name = $_FILES["id_verification_video_file"]["name"]; 
    $video_file_tmp = $_FILES["id_verification_video_file"]["tmp_name"]; 
    $video_file_type = $_FILES["id_verification_video_file"]["type"]; 
    $video_file_size = $_FILES["id_verification_video_file"]["size"]; 
    $video_file_error = $_FILES['id_verification_video_file']['error']; 

    $video_file_ext = pathinfo($video_file_name, PATHINFO_EXTENSION); 

    //Checking File Type using pathinfo_extension() Function.       
    if(!in_array(pathinfo($img_file_name, PATHINFO_EXTENSION),$img_allowed_ext)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 2a: Invalid File! Only jpg, jpeg, png and gif image files are allowed!'; 
        $error = 1; 
    } 

    if(!in_array(pathinfo($video_file_name, PATHINFO_EXTENSION),$video_allowed_ext)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 2b: Invalid File! Only mp4, wav, ogg, flv, wmv and avi video files are allowed!'; 
        $error = 1; 
    }           

    //Checking Mime Type using mime_content_type() Function.        
    if(!in_array(mime_content_type($img_file_name),$img_mime_type)) 
    { 
        $error_msg['img_error']= '<p class="text-danger">ERROR STATEMENT 3a: Invalid File! Only jpg, jpeg, png and gif image files are allowed!'; 
        $error = 1; 
    }       

    if(!in_array(mime_content_type($video_file_name),$video_mime_type)) 
    { 
        $error_msg['video_error'] =  '<p class="text-danger">ERROR STATEMENT 3b: Invalid File! Only mp4, wav, ogg, flv, wmv and avi video files are allowed!'; 
        $error = 1; 
    } 


    //Checking File Sizes using filesize() function. 
    //5MB Image Size Allowed. 
    if(filesize($img_file_name) > 5000000) 
    { 
        $error_msg['img_file_size_err'] = '<p class="text-danger">ERROR STATEMENT 4a: File Size is greater than 5MB. File Size should not exceed the 100MB limit!'; 
        $error = 1; 
    } 
    //10MB Video Size Allowed.          
    if(filesize($video_file_name) > 10000000) 
    { 
        $error_msg['video_file_size_err'] = '<p class="text-danger">ERROR STATEMENT 4b: File Size is greater than 10MB. File Size should not exceed the 100MB limit!';  
        $error = 1; 
    }           

    //Checking for NO errors to proceed with the script flow. 
    if($error == 0)
    { 
        $user = $user; //Account Username here. 
        //$db_user = 'followingbrowser_user'; //Database username here. Has to be in quotes. 
        $db_user = 'root'; //Database username here. Has to be in quotes. 
        //Feed Id Verification Video & Image File Upload Directory path. 
        $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
        $default_directory_path_and_user_dir = "$default_directory_path"."/"."$user"; //Permanent Storage Directory Path for $user Folder. 

        //Create $user Folder in Permanent Storage Directory Path: 'uploads/videos/id_verifications' Folder.                
        if(!is_dir($default_directory_path_and_user_dir)) 
        {               
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($default_directory_path_and_user_dir,$mode,TRUE); //This line is working and is correct even without quoting "$mode". Requinix sugegsted to quote "$mode". 
        } 

       //Making Directories of every Files Types for Respective User.               
        $user_img_directory = "$default_directory_path_and_user_dir"."/"."imgs"; 
        $user_video_directory = "$default_directory_path_and_user_dir"."/"."videos"; 

        if(!is_dir($user_img_directory)) 
        { 
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($user_img_directory,$mode,TRUE); //This line is correct and working even without quoting $mode.
        } 

        if(!is_dir($user_video_directory)) 
        { 
            //$db_user = 'followingbrowser_user'; //Has to be in quotes. 
            $db_user = 'root'; //Has to be in quotes. 
            $mode = 0755; 
            mkdir($user_video_directory,$mode,TRUE); //This line is correct and working even without quoting $mode. 
        }               

        //User Files Directories. 
        $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
        $default_directory_path_and_user_dir = "$default_directory_path"."/"."$user"; //Permanent Storage Directory Path for $user Folder. 
        $user_img_directory = "$default_directory_path_and_user_dir"."/"."img"; 
        $user_video_directory = "$default_directory_path_and_user_dir"."/"."videos"; 
        $user_id_img_file = "$user_img_directory"."/"."$img_file_name"."$img_file_ext"; 
        $user_id_video_file = "$user_video_directory"."/"."$video_file_name"."$video_file_ext"; 

        //Uploading the Files. 
        $upload_err =  0; 

        //Uploading Image File 
        if(file_exists("$user_img_directory/$user.png")) 
        { 
            $error_msg['upload_img_error'] = '<p class="text-danger">ERROR STATEMENT 5c: You have already uploaded an Image File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</p>'; 
            $upload_err = 1; 
        } 

        //Uploading Video File 
        if(file_exists("$user_video_directory/$user.mp4")) 
        { 
            $error_msg['upload_video_error'] = '<p class="text-danger">ERROR STATEMENT 5e: You have already uploaded a Video File to verify your ID! No need to upload to get verified again! If you uploaded the wrong file then you need to delete this account and open a new one!</</p>'; 
            $upload_err = 1; 
        } 

        //Checking for NO errors to proceed with the script flow. 
        if($upload_err == 0) 
        { 
            //DIRECTORY PATHS AGAIN
            //1. $default_directory_path = 'uploads/id_verifications'; //Permanent Storage Directory Path. 
            //2. $default_directory_path_and_user_dir = "$default_directory_path"."/".$user; //Permanent Storage Directory Path for $user Folder. 
            //3. $user_img_directory = $default_directory_path_and_user_dir."."/".img'; 
            //4. $user_video_directory = $default_directory_path_and_user_dir."."/".videos';

            if(is_uploaded_file($img_file_tmp) && is_uploaded_file($video_file_tmp)) 
            { 
                if(move_uploaded_file($img_file_tmp,$user_id_img_file)) 
                { 
                    rename($user_id_img_file,$user_img_directory.$user.'.'.$img_file_ext); 
                } 

                if(move_uploaded_file($video_file_tmp,$user_id_video_file)) 
                { 
                    rename($user_id_video_file,$user_video_directory.$user.'.'.$video_file_ext); 
                } 

                $success_msg['all_uploads'] = 'SUCCESS STATEMENT 6a: Both Image and Video files have been uploaded successfully!'; 
            } 
            else 
            {        
                $error_msg['all_uploads'] = 'ERROR STATEMENT 6b: Both Image and Video files failed to upload successfully! You may try again another time!'; 
                exit(); 
            } 
        } 
    }
}
    }
    ?> 

Почему не удается найти файл? Я просмотрел файлы и выбрал их. Файлы png и mp4.

...