Description
Create the attachment file from the temporary fileUse media_handle_sideload() to do the validation and storage stuff
Usage
oikms_create_attachment( $atts, $file, $desc, $post_id );Parameters
- $atts
- ( mixed ) required –
- $file
- ( mixed ) required –
- $desc
- ( mixed ) required –
- $post_id
- ( mixed ) optional –
Returns
voidSource
File name: oik-mshot/shortcodes/oik-mshot.phpLines:
1 to 15 of 15
function oikms_create_attachment( $atts, $file, $desc, $post_id=0 ) { $file_array['tmp_name'] = $file; $file_array['type'] = mime_content_type( $file ); $file_array['name'] = oikms_create_attachment_filename( $atts ); bw_trace2( $file_array ); $id = media_handle_sideload( $file_array, $post_id, $desc ); if ( is_wp_error( $id ) ) { bw_trace2( $id ); } else { // e( "attachment: $id" ); } return( $id ); }View on GitHub
Called by
1 to 1 of 1
Invoked by
Calls
1 to 2 of 2
Call hooks
API Letters:
