Title: Change Default Upload Path
Last modified: January 10, 2018

---

# Change Default Upload Path

 *  Resolved [mrmocha](https://wordpress.org/support/users/mrmocha/)
 * (@mrmocha)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/change-default-upload-path/)
 * Hello,
 * Is it possible to change the default upload path so that files are uploaded in
   the usual way to wp-contents/uploads/*year*/*month* rather than wp-contents/uploads/
   dlm_uploads//*year*/*month*
 * Basically I need the files unprotected by default.
 * I know the files could simply be added via the regular WordPress media upload
   area and then selected on a Download page, but this is for a client and I would
   like to make it so they don’t have to visit multiple areas of the admin to get
   a download published.
 * Thanks for any advice.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [mrmocha](https://wordpress.org/support/users/mrmocha/)
 * (@mrmocha)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9852021)
 * Just to shine a bit more light on this – I just want the downloads to be freely
   accessible. I have added `add_filter( 'dlm_do_not_force', '__return_true' );`
   to my functions file so the files open directly in the browser. But they all 
   result in 404s unless I edit the htaccess file in the dlm_uploads folder to remove
   the `deny from all` directive….which feels wrong…
 *  [Harish Chouhan](https://wordpress.org/support/users/hchouhan/)
 * (@hchouhan)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9867575)
 * Hey [@mrmocha](https://wordpress.org/support/users/mrmocha/),
 * I regret to say this falls under custom development and I would suggest contacting
   a 3rd party developer. Also, please note that the filter you used is useful when
   you are using the “Redirect to File” feature.
 *  Thread Starter [mrmocha](https://wordpress.org/support/users/mrmocha/)
 * (@mrmocha)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9892936)
 * Ok. Thank you for getting back to me
 *  [dangrimes](https://wordpress.org/support/users/damonmaldonado/)
 * (@damonmaldonado)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9948346)
 * I know this is marked as resolved but in case anyone finds this going forward
   you can change the upload location using the ‘upload_dir’ filter.
 * The following function is modified from the method used in the plugin to set 
   the directory.
 * The value for `$new_upload_directory` sets the folder, if you want to use the
   WordPress default set this to an empty string.
 *     ```
       function override_dl_upload_dir( $pathdata ) {
       		$new_upload_directory = '/new_upload_directory';
       		if ( isset( $_POST['type'] ) && 'dlm_download' === $_POST['type'] ) {
       			//if no subdirectory set add one
       			if ( empty( $pathdata['subdir'] ) ) {
       				$pathdata['path']   = $pathdata['path'] . $new_upload_directory;
       				$pathdata['url']    = $pathdata['url'] . $new_upload_directory;
       				$pathdata['subdir'] = $new_upload_directory;
       			} else {
       				//if subdirectory is set, replace '/dlm_uploads' 
       				$new_subdir = $new_upload_directory . str_replace('/dlm_uploads', '', $pathdata['subdir'] );
   
       				$pathdata['path']   = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] );
       				$pathdata['url']    = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] );
       				$pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] );
   
       			}
       		}
   
       		return $pathdata;
       	}
   
           add_filter('upload_dir', 'override_dl_upload_dir', 99);
       ```
   
 *  Plugin Contributor [Barry Kooij](https://wordpress.org/support/users/barrykooij/)
 * (@barrykooij)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9948509)
 * Thanks a lot for sharing this [@damonmaldonado](https://wordpress.org/support/users/damonmaldonado/).
   I hope this will help people!
 *  Thread Starter [mrmocha](https://wordpress.org/support/users/mrmocha/)
 * (@mrmocha)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9962317)
 * Thank you for taking the time to reply [@damonmaldonado](https://wordpress.org/support/users/damonmaldonado/).
   This looks very helpful 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Change Default Upload Path’ is closed to new replies.

 * ![](https://ps.w.org/download-monitor/assets/icon-256x256.png?rev=3198936)
 * [Download Monitor](https://wordpress.org/plugins/download-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/download-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-monitor/reviews/)

## Tags

 * [downloads](https://wordpress.org/support/topic-tag/downloads/)
 * [path](https://wordpress.org/support/topic-tag/path/)

 * 6 replies
 * 4 participants
 * Last reply from: [mrmocha](https://wordpress.org/support/users/mrmocha/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/change-default-upload-path/#post-9962317)
 * Status: resolved