WordPress.org

Support

Support » Plugins and Hacks » Frontend Uploader » [Resolved] Uploaded photos going into wrong folder

[Resolved] Uploaded photos going into wrong folder

  • When using the Frontend Uploader, I noticed that for the last couple of days the photos, once approved, go into the upload folder 2012/12 even though it is 2013 and should be going into 2013/03. When I upload directly with Media Library, they do go into the correct folder 2013/03. So it appears to be a Frontend Uploader issue. Any suggestions? I tried uninstalling and reinstalling the plugin, same problem

    http://wordpress.org/extend/plugins/frontend-uploader/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Rinat Khaziev

    @rinatkhaziev

    Can you post the steps to reproduce and also more details about your setup (wp version, hosting, etc)

    WordPress 3.5.1 being hosted on Bluehost. The directories 2013/01 02 03 have all been created, but anything I upload in the last couple of days with the Frontend Uploader goes into 2012/12 (wp-content/uploads/) I was wondering if anyone else had encountered this problem. I don’t seem to be having a date issue with any other aspect of the site. The plugin was installed from within WP.

    Just upgraded to version .4 of the plugin. Same thing, upload through the plugin, the photo goes into 2012/12, upload through media library, photo goes into 2013/03.

    Further to the above, I am using the current version of the Suffusion WP theme and the photos continue to go into 2012/12. Also, I discovered that whatever is entered into the author field is overridden by the user’s logon id and whatever is entered into the credit field does not seem to be carried over to any field at all.

    Plugin Author Rinat Khaziev

    @rinatkhaziev

    Hey can you try to disable the plugin and see if media still goes to the wrong folder?

    If I don’t use the uploader, if I just use the Media library uploader, all uploads go into the correct 2013/03 folder.

    On a different wp site on the same server, using a different theme, I am contributing photos on 2013/04/02 but the photos are ending up in 2013/03

    Plugin Author Rinat Khaziev

    @rinatkhaziev

    Hey,

    Thanks. I was able to track it down. Apparently it’s an issue that was introduced with WP 3.5. I tracked it down to an underlying WP core API methods. I will fix it soon-ish 🙂

    Plugin Author Rinat Khaziev

    @rinatkhaziev

    Ok, so I investigated a bit further. It appears to be that WordPress’ core upload functions set upload folder based on a post that it’s attached to.

    E.g.: You’ve created your post that holds Frontend Uploader shortcode in Dec 2012. Hence all the attachments get uploaded to 2012/12.

    There’s a workaround for it, but it’s kinda obtrusive and might lead to unexpected consequences. If it’s really important for you, here’s a snippet that’ll take care of your issue.

    add_filter( 'upload_dir', 'my_filter_upload_dir' );
    function my_filter_upload_dir( $upload_dir ) {
    			// Keep the original year/month
    			$old_subdir = $upload_dir['subdir'];
    
    			// Generate the yearly and monthly dirs
    			$time = current_time( 'mysql' );
    			$y = substr( $time, 0, 4 );
    			$m = substr( $time, 5, 2 );
    			$new_subdir = "/$y/$m";
    
    			// Replace the old year and month to the current ones on upload
    			foreach( $upload_dir as $index => $dir ) {
    				if ( !is_bool( $dir ) )
    					$upload_dir[$index] = str_replace( $old_subdir, $new_subdir, $dir );
    			}
    
    		return $upload_dir;
    	}

    Thanks so much for tracking this down. As long as I understand what’s happening I can work with it. Great support!

    Also, any way to drop the credit field, since information entered there does not seem to go anywhere?

    Plugin Author Rinat Khaziev

    @rinatkhaziev

    Regarding the credit, it’s a known issue, there’s no way to remove the field currently. The underlying issue is the top priority for the next version.

    Marking as resolved since original question was resolved

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] Uploaded photos going into wrong folder’ is closed to new replies.
Skip to toolbar