﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
16981	Importer uploads to incorrect directory	duck_		"In some situations the importer may upload a file to a different directory compared to the export site.

'''Steps to reproduce:'''
 0. Ensure the default yyyy/mm uploads organisation setting is enabled.
 1. Create a post. Set the publish date to 2005/03/xx.
 2. Upload an image to the post, it will be uploaded to wp-content/uploads/2005/03/image.jpg per media_handle_upload(), see [9663]
 3. Export.
 4. Import on a new site.

The image will be located in wp-content/uploads/2011/03/ (subject to change, it will be the post_date of the attachment, i.e. date of upload).

This occurs because the attachment's post_date, which the importer relies on to set the upload directory, may be different to the folder it is stored in (see media_handle_upload() and [9663] again).

Proposed solution is to attempt to grab the upload location from `_wp_attached_file` post meta and fallback to post_date which is correct in most cases.

Do we also want to start setting the post_date of attachments to be the same as the parent post? `'post_date' => $time` in media_handle_upload() and friends.
"	defect (bug)	closed	normal	WordPress.org	Import		normal	fixed	has-patch	
