media_handle_sideload
media_handle_sideload ( $file_array, $post_id = 0, $desc = null, $post_data = array() )
Parameters:- (string[]) file_array Array that represents a `$_FILES` upload array.
- (int) post_id Optional. The post ID the media is associated with.
- (string) desc Optional. Description of the side-loaded file. Default null.
- (array) post_data Optional. Post data to override. Default empty array.
Returns:- (int|WP_Error) The ID of the attachment or a WP_Error on failure.
Defined at:Change Log: - Introduced in WordPress: 2.6.0
- Deprecated in WordPress: —
Description
Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().