Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 232 to 241

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)) && !is_banned_extension($extension))
        {
        return 
true;
        }
    return 
false;
    }

This article was last updated 25th April 2024 15:35 Europe/London time based on the source file dated 28th March 2024 13:54 Europe/London time.