WordPress at a glance

wp_handle_upload() WP 1.0

Wrapper for _wp_handle_upload().

Passes the 'wp_handle_upload' action.

  • See: _wp_handle_upload()
Is the basis for: media_handle_upload()
Works based on: _wp_handle_upload()

No Hooks.

Return

Array. On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).

Usage

wp_handle_upload( &$file, $overrides, $time );
$file(array) (required)
Reference to a single element of $_FILES. Call the function once for each uploaded file.
$overrides(array/true/false)
An associative array of names=>values to override default variables.
Default: false
$time(string)
Time formatted in 'yyyy/mm'.
Default: null

Code of wp_handle_upload: wp-admin/includes/file.php VER 4.9.8

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

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

Related Functions

From tag: upload download (file system)

No comments
    Hello, !     Log In . Register