Store uploads according to the parent post date when using year/month sub-directories

git-svn-id: https://develop.svn.wordpress.org/trunk@9663 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2008-11-13 18:22:00 +00:00
parent 6a0d610cb3
commit f587fabad8
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -173,7 +173,11 @@ win.send_to_editor('<?php echo addslashes($html); ?>');
*/
function media_handle_upload($file_id, $post_id, $post_data = array()) {
$overrides = array('test_form'=>false);
$file = wp_handle_upload($_FILES[$file_id], $overrides);
$post = get_post($post_id);
$time = $post->post_date_gmt;
$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
if ( isset($file['error']) )
return new WP_Error( 'upload_error', $file['error'] );