Uploads and limitsesw_svg_upload_filter_check_init()

esw_svg_upload_filter_check_init()

Upload and sideload prefilter that sanitizes an SVG or refuses 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_svg_upload_filter_check_init( array $file ): array

Example

$file = esw_svg_upload_filter_check_init( $file );
if ( ! empty( $file['error'] ) ) {
	return $file;
}

Description

Hooked on wp_handle_upload_prefilter and wp_handle_sideload_prefilter while SVG uploads are switched on. The client MIME type is ignored: wp_check_filetype_and_ext() decides. A file named .svg that WordPress would not accept as image/svg+xml gets an error; a real SVG is sanitized in place through esw_svg_file_checker() and gets an error when that fails.

Parameters

body
$filearray

The $_FILES-style array with name and tmp_name.

Return value

returnarray

The array, with type set or error added.