Collections functions
General 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 236 to 245

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 29th November 2023 07:35 Europe/London time based on the source file dated 18th October 2023 21:55 Europe/London time.