• Resolved freegio


    I have created my own structure for saving files to the uploads folder (“uploads/year/month/day/minute), if I upload the file manually, then it is saved correctly in the folder, but if I import images using the plugin Import WP files are saved in the root folder “uploads/” resp. “uploads/year/month/”.
    How can I save files using plugin Import WP according to my own structure?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author jcollings


    Hi Gio,

    Import WP uses core WordPress functions to move and store attachments, What WordPress filter or plugin have you used to alter the uploads file path, can you give me an example of what you have done and i can have a look and see what might be causing the issue.


    Thread Starter freegio


    Hi James,

    Thanks for your reply. I use the Custom Upload Dir plugin (https://wordpress.org/plugins/custom-upload-dir/) for set the path in the “uploads/” folder. The plugin creates physical folders. The plugin works very well for manually uploading files, how for example such as uploading images to a media library. Makes directories and directories path exactly how settings. (my custom settings is /uploads/year/month/day/hour/minute/). With plugin Custom Upload Dir are files saved well in a small amount to more folders.

    For that reason I’m need solve saving files importing with Import WP same as with Custom Upload Dir, because when I’m importing xml file everyday, sometimes are upload a lot of images. With WordPress original settings I have after import in folder “uploads/” e.g. more than 18k images files and this not well.

    When I used Import WP, all images was succefully imported, but not with path set by Custom Upload Dir, but with original settings WordPress (uploads/year/month/) ie. still I have a lot of files in default folder.
    Is this example sufficient?

    thank you in advance for your help


    Thread Starter freegio



    	$subdir = '';
    	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
    		// Generate the yearly and monthly directories.
    		// modified to generate subdir y/m/d/h/min
            if ( ! $time ) {
    			$time = current_time( 'mysql' );
    		$y      = substr( $time, 0, 4 );
    		$m      = substr( $time, 5, 2 );
            $d      = substr( $time, 8, 2 );                   //added
            $h      = substr( $time, 11, 2 );                  //added
            $min      = substr( $time, 14, 2 );                //added
    		$subdir = "/$y/$m/$d/$h/$min";                     //modified
    	$dir .= $subdir;
    	$url .= $subdir;
    Thread Starter freegio


    Adjusted file wp-includes/functions.php

    • This reply was modified 1 year, 11 months ago by freegio.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom uploads folder’ is closed to new replies.