Security methods
checkUploadedFile( file, p )
Checks an uploaded file for security attacks and moves it to a safe place if it is considered secure. It moves the file to a safe place, specified by the returned Result property "finalPath".
When checking uploaded images (
isRequireImageorallowedImageTypeshas been set), image types other than jpg, gif or png are converted to png.When uploading compressed image formats like jpg, since this method generates a new image from the uploaded one for security purposes, the final compression is always set to the maximum possible setting. This will cause compressed images like jpg files to take more disk space than their originals in most cases.
fileThe file array given by PHP after receiving an uploaded file, received via $_FILES[name of the file]setupOptional hash arrayisRequireImageRequires the file to be an image. IfallowedImageTypesis specified, this is forced to true.allowedFileExtensionsIf value is specified with an array of extensions, only those file extensions are allowed. For example:["pdf", "rtf"]. IfallowedImageTypesis specified and this is not, file extensions matching the specificallowedImageTypeswill be required automatically.allowedImageTypesIf value is specified with an array of IMG_?, only those image types are allowed (See https://www.php.net/manual/en/image.constants.php). If not specified, all image types supported by GD are accepted.
Returns: A Result object with the following payloads:
descriptionA description of what went wrongfinalPathThe complete path where the file was moved if it was considered safe
Last updated
Was this helpful?