Fix uploads sub-directory for drafts, props DD32, fixes #8205

git-svn-id: https://develop.svn.wordpress.org/trunk@9675 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2008-11-14 03:26:06 +00:00
parent a697919990
commit 04ce1eb950
1 changed files with 6 additions and 3 deletions

View File

@ -174,8 +174,11 @@ win.send_to_editor('<?php echo addslashes($html); ?>');
function media_handle_upload($file_id, $post_id, $post_data = array()) { function media_handle_upload($file_id, $post_id, $post_data = array()) {
$overrides = array('test_form'=>false); $overrides = array('test_form'=>false);
$post = get_post($post_id); $time = current_time('mysql', true);
$time = $post->post_date_gmt; if ( $post = get_post($post_id) ) {
if ( substr( $post->post_date, 0, 4 ) > 0 )
$time = $post->post_date;
}
$file = wp_handle_upload($_FILES[$file_id], $overrides, $time); $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);