Changeset 16383
- Timestamp:
- 11/15/2010 12:53:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r16340 r16383 240 240 241 241 /** 242 * {@internal Missing Short Description}}243 * 244 * @since unknown245 * 246 * @param unknown_type $file_array247 * @param unknown_type $post_id248 * @param unknown_type $desc249 * @param unknown_type $post_data250 * @return unknown242 * This handles a sideloaded file in the same way as an uploaded file is handled by {@link media_handle_upload()} 243 * 244 * @since 2.6 245 * 246 * @param array $file_array Array similar to a {@link $_FILES} upload array 247 * @param int $post_id The post ID the media is associated with 248 * @param string $desc Description of the sideloaded file 249 * @param array $post_data allows you to overwrite some of the attachment 250 * @return int|object The ID of the attachment or a WP_Error on failure 251 251 */ 252 252 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) { … … 284 284 // Save the attachment metadata 285 285 $id = wp_insert_attachment($attachment, $file, $post_id); 286 if ( !is_wp_error($id) ) {286 if ( !is_wp_error($id) ) 287 287 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 288 return $url; 289 } 288 290 289 return $id; 291 290 } … … 519 518 520 519 // If error storing temporarily, unlink 521 if ( is_wp_error( $tmp) ) {520 if ( is_wp_error( $tmp ) ) { 522 521 @unlink($file_array['tmp_name']); 523 522 $file_array['tmp_name'] = ''; … … 525 524 526 525 // do the validation and storage stuff 527 $id = media_handle_sideload( $file_array, $post_id, @$desc);528 $src = $id;526 $id = media_handle_sideload( $file_array, $post_id, @$desc ); 527 $src = get_attachment_link( $id ); 529 528 530 529 // If error storing permanently, unlink
Note: See TracChangeset
for help on using the changeset viewer.