Collections functions
General functions
Render functions
Theme permission functions
Resource functions

check_valid_file_extension()

Description

Basic check of uploaded file against list of allowed extensions

Parameters

ColumnTypeDefaultDescription
$uploadedfile array - an element from the $_FILES PHP reserved variable
$validextensions array Array of valid extension strings

Return

bool

Location

include/file_functions.php lines 211 to 220

Definition

 
function check_valid_file_extension($uploadedfile,array $validextensions)
    {
    
$pathinfo   pathinfo($uploadedfile['name']);
    
$extension  $pathinfo['extension'] ?? "";
    if(
in_array(strtolower($extension),array_map("strtolower",$validextensions)))
        {
        return 
true;
        }
    return 
false;
    }

This article was last updated 26th June 2022 05:05 Europe/London time based on the source file dated 9th June 2022 15:55 Europe/London time.