wp_handle_sideload() WordPress Function

wp_handle_sideload() is a function used by WordPress to process a file that has been uploaded by a user through a web form. The function will save the uploaded file to the WordPress uploads directory and return an array containing the file's URL, type, and other data.

wp_handle_sideload( array $file, array|false $overrides = false, string $time = null ) #

Wrapper for _wp_handle_upload().


Description

Passes the ‘wp_handle_sideload’ action.

Top ↑

See also


Top ↑

Parameters

$file

(array)(Required)Reference to a single element of $_FILES. Call the function once for each uploaded file. See _wp_handle_upload() for accepted values.

$overrides

(array|false)(Optional) An associative array of names => values to override default variables. See _wp_handle_upload() for accepted values.

Default value: false

$time

(string)(Optional) Time formatted in 'yyyy/mm'.

Default value: null


Top ↑

Return

(array) See _wp_handle_upload() for return value.


Top ↑

Source

File: wp-admin/includes/file.php

function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
	/*
	 *  $_POST['action'] must be set and its value must equal $overrides['action']
	 *  or this:
	 */
	$action = 'wp_handle_sideload';
	if ( isset( $overrides['action'] ) ) {
		$action = $overrides['action'];
	}

	return _wp_handle_upload( $file, $overrides, $time, $action );
}


Top ↑

Changelog

Changelog
VersionDescription
2.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.