Function __global->check_extension

Definitions

sources/files2.php

  • Check uploaded file extensions for possible malicious intent, and if some is found, an error is put out, and the hackattack logged.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
&$path string Yes No required parameter N/A N/A The file path or filename
$skip_server_side_security_check boolean No No False N/A N/A Whether to skip the server side security check
$file_to_delete ?string No No Null N/A N/A Delete this file if we have to exit (null: no file to delete)
$accept_errors boolean No No False N/A N/A Whether to allow errors without dying
$member_id ?MEMBER No No Null N/A N/A Member to check as (null: current member)

Returns

  • Success status
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Check uploaded file extensions for possible malicious intent, and if some is found, an error is put out, and the hackattack logged.
 *
 * @param  string $path The file path or filename
 * @param  boolean $skip_server_side_security_check Whether to skip the server side security check
 * @param  ?string $file_to_delete Delete this file if we have to exit (null: no file to delete)
 * @param  boolean $accept_errors Whether to allow errors without dying
 * @param  ?MEMBER $member_id Member to check as (null: current member)
 * @return boolean Success status
 */

function check_extension(string &$path, bool $skip_server_side_security_check = false, ?string $file_to_delete = null, bool $accept_errors = false, ?int $member_id = null) : bool