Uploads and limitsesw_upload_check()

esw_upload_check()

Gives an SVG its type back when fileinfo could not name it.

Function · Easy SVG · Status: Internal · Defined in easy-svg.php

Internal: not part of the promised public surface. It may change without notice.

Usage

esw_upload_check( array $checked, string $file, string $filename, array $mimes ): array

Example

$checked = esw_upload_check( $checked, $tmp, 'logo.svg', get_allowed_mime_types() );

Description

Hooked on wp_check_filetype_and_ext while SVG uploads are on. fileinfo often reads an SVG without an XML declaration as text and core drops its type. When the name ends in .svg, no type was found, and the site allows image/svg+xml, this returns ext svg and type image/svg+xml so the upload filter can sanitize the file. Pluggable like esw_add_support().

Parameters

body
$checkedarray

ext, type and proper_filename.

body
$filestring

Full path.

body
$mimesarray

Allowed types.

Return value

returnarray

The check result.