equal
deleted
inserted
replaced
54 |
54 |
55 if ( empty( $_FILES[ $form ]['name'] ) && empty( $_GET[ $urlholder ] ) ) { |
55 if ( empty( $_FILES[ $form ]['name'] ) && empty( $_GET[ $urlholder ] ) ) { |
56 wp_die( __( 'Please select a file' ) ); |
56 wp_die( __( 'Please select a file' ) ); |
57 } |
57 } |
58 |
58 |
59 //Handle a newly uploaded file, Else assume it's already been uploaded |
59 // Handle a newly uploaded file. Else, assume it's already been uploaded. |
60 if ( ! empty( $_FILES ) ) { |
60 if ( ! empty( $_FILES ) ) { |
61 $overrides = array( |
61 $overrides = array( |
62 'test_form' => false, |
62 'test_form' => false, |
63 'test_type' => false, |
63 'test_type' => false, |
64 ); |
64 ); |
69 } |
69 } |
70 |
70 |
71 $this->filename = $_FILES[ $form ]['name']; |
71 $this->filename = $_FILES[ $form ]['name']; |
72 $this->package = $file['file']; |
72 $this->package = $file['file']; |
73 |
73 |
74 // Construct the object array |
74 // Construct the object array. |
75 $object = array( |
75 $object = array( |
76 'post_title' => $this->filename, |
76 'post_title' => $this->filename, |
77 'post_content' => $file['url'], |
77 'post_content' => $file['url'], |
78 'post_mime_type' => $file['type'], |
78 'post_mime_type' => $file['type'], |
79 'guid' => $file['url'], |
79 'guid' => $file['url'], |
97 |
97 |
98 $this->filename = $attachment->post_title; |
98 $this->filename = $attachment->post_title; |
99 $this->package = get_attached_file( $attachment->ID ); |
99 $this->package = get_attached_file( $attachment->ID ); |
100 } else { |
100 } else { |
101 // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler. |
101 // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler. |
102 if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) { |
102 $uploads = wp_upload_dir(); |
|
103 if ( ! ( $uploads && false === $uploads['error'] ) ) { |
103 wp_die( $uploads['error'] ); |
104 wp_die( $uploads['error'] ); |
104 } |
105 } |
105 |
106 |
106 $this->filename = sanitize_file_name( $_GET[ $urlholder ] ); |
107 $this->filename = sanitize_file_name( $_GET[ $urlholder ] ); |
107 $this->package = $uploads['basedir'] . '/' . $this->filename; |
108 $this->package = $uploads['basedir'] . '/' . $this->filename; |