<?php 
//upload file
$fileA = "file3";
$fileA_Title = "Meta";
$mb = 1024 * 1024; $kb = 1024;
$file = RMC($_FILES[$fileA]["name"]);
//file details
$file_size = strtolower($_FILES[$fileA]["size"]); $file_size = str_replace(",","",number_format($file_size/$mb,2));
//
$ext = explode('.', basename($_FILES[$fileA]['name']));//explode file name from dot(.) 
$file_extension = strtolower(end($ext)); //store extensions in the variable
$validextensions = array("jpeg", "gif", "jpg", "png");  //Extensions which are allowed
$ext = ".$file_extension";
//
$file_dir = "../j_files/j_img/logo/";   	
$time = time();
//
if(!empty($file)){
	if($file_size <= 4){
		if (in_array($file_extension, $validextensions)) {
			//$new_file = "p$time$id$ext"; //rename file
			//$new_file = "logo-meta-$time.png"; //rename file
			$new_file = "logo-meta.png"; //rename file
			$file_dir = "$file_dir$new_file";
            //die($file_dir);
			if(move_uploaded_file($_FILES[$fileA]['tmp_name'], ''.$file_dir)){ //SAVE FILE
				$file3 = "$new_file";
                $sql4="UPDATE j_company SET j_logo_meta='".$file3."'";  
                $result4 = runSQL($sql4);
			}else{ die ("<div class='alert alert-danger'> Invalid $fileA_Title Choose another.</div>"); } //
		}else{ die ("<div class='alert alert-danger'> Invalid $fileA_Title Type. Choose another.</div>"); }  
	}else{ die ("<div class='alert alert-danger'> Invalid $fileA_Title Size. Max: 4MB. Choose another.</div>"); }  
}else{ 
    /*
    if(!empty($passport)){
    $u_passport=$passport;
    }else{
    die ("<div class='alert alert-danger'> Please choose a Passport.</div>"); }
    */
}
//end upload file
?>