Title: Custom Upload Dir
Author: ulfben
Published: <strong>4 gruodžio, 2007</strong>
Last modified: 26 liepos, 2022

---

Ieškoti įskiepiuose

Šis įskiepis **nebuvo išbandytas su 3 vėliausiomis WordPress versijomis**. Jis tikriausiai
nėra prižiūrimas ir palaikomas, todėl gali neveikti su naujausiomis WordPress versijomis.

![](https://s.w.org/plugins/geopattern-icon/custom-upload-dir.svg)

# Custom Upload Dir

 Autorius [ulfben](https://profiles.wordpress.org/ulfben/)

[Parsisiųsti](https://downloads.wordpress.org/plugin/custom-upload-dir.3.4.6.zip)

 * [Informacija](https://lt.wordpress.org/plugins/custom-upload-dir/#description)
 * [Atsiliepimai](https://lt.wordpress.org/plugins/custom-upload-dir/#reviews)
 *  [Diegimas](https://lt.wordpress.org/plugins/custom-upload-dir/#installation)
 * [Kūrimas](https://lt.wordpress.org/plugins/custom-upload-dir/#developers)

 [Pagalba](https://wordpress.org/support/plugin/custom-upload-dir/)

## Aprašymas

WordPress allow you to put uploads in year- and month-based folders. Custom Upload
Dir is more flexible. You can construct paths from variables like post title, category,
post author, post date [and many more](https://wordpress.org/extend/plugins/custom-upload-dir/screenshots/).

I created Custom Upload Dir ensure my file system is always mirroring the site structure.
This ensures I can always find files manually when needed. It also simplifies backups
and platform migrations.

//_[Ulf Benjaminsson](http://www.ulfbenjaminsson.com)_

#### Changelog v. 3.4.6 (2020-07-17)

 1. fixed a null dereference error. ([thanks, defotoverij](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-null-given/)!)

#### Changelog v. 3.4.5 (2020-05-05)

 1. added french translation (thanks, bibi699depreau!)

#### Changelog v. 3.4.4 (2019-03-24)

 1. Fixed a few PHP warnings
 2. Removed the %permalink% template as it broke uploads to drafts.

#### Changelog v. 3.4.3.2 (2019-03-24)

 1. Added support for the Gutenberg editor.

#### Changelog v. 3.4.2 (2015-03-16)

 1. Added [filter ‘cud_generate_path’](https://wordpress.org/plugins/custom-upload-dir/installation/)
    so you can easily adjust the path with any variable you want.
 2. Added %mime_type% to sort files by mime type
 3. Added %author_role% to sort files by author role.
 4. Coming: support for per-post-type settings. Eg: every post type can have their 
    own rules for where to place uploads. Currently missing the admin interface. If
    you feel like helping out, let me know.

#### Changelog v. 3.4 (2013-02-09)

 1. Added %file_ext% to sort by file type
 2. Added [tentative support for uploads from WordPress apps](https://wordpress.org/support/topic/search-and-mobile-apps-compatibility?replies=6#post-3837193).
 3. Removed setting for „Base upload folder” as WP core no longer exposes this
 4. Cleared out some PHP error on the admin page
 5. Fixed leaking CSS on admin page

#### Changelog v. 3.3 (2011-12-18)

 1. Support for WordPress 3.3
 2. Support for tags and categories
 3. Support for custom taxonomies
 4. Added %current_user%, %permalink%
 5. Added all permalink tags
 6. Added test-function to admin page

[Older changelogs moved here.](https://wordpress.org/extend/plugins/custom-upload-dir/changelog/)

### Additional Info

Copyright (C) 2007-2019 [Ulf Benjaminsson](https://www.ulfbenjaminsson.com)

This program is free software; you can redistribute it and/or modify
 it under the
terms of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
 but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
 along with this
program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
330, Boston, MA 02111-1307 USA

## Ekrano nuotraukos

 * [[
 * The configuration screen.
 * [[
 * Shows how the upload path corresponds to the post’s timestamp.

## Diegimas

 1. Extract the `custom-upload-dir`-folder and transfer it to the `/wp-content/plugins/`
    directory
 2. Aktyvuokite įskiepį per WordPress meniu „Įskiepiai”
 3. Customize your directory structure in `Settings -> Custom Upload Dir`

## DUK

### How do I change base upload folder?

Since WP 3.5, by a setting in wp-config.php:

    ```
    define('UPLOADS', WP_CONTENT_DIR.'/your-folder');
    ```

Just be aware that this will likely break all paths to your previously uploaded 
stuff.

### How can I define my own tags?

Use the `cud_generate_path`-filter, like so:

    ```
    function my_generate_path($template, $post_id){
        $my_tags = array('%tag1%','%tag2%');
        $replace = array($data, getData());
        $customdir = str_replace($tags, $replace, $template);
        return $customdir;
    }
    add_filter('cud_generate_path', 'my_generate_path');
    ```

## Atsiliepimai

![](https://secure.gravatar.com/avatar/5a2f6034a2fb4744127a18771de1bf86a41ef0c5038be25da8a55026e16cf4cb?
s=60&d=retro&r=g)

### 󠀁[работает как надо](https://wordpress.org/support/topic/%d1%80%d0%b0%d0%b1%d0%be%d1%82%d0%b0%d0%b5%d1%82-%d0%ba%d0%b0%d0%ba-%d0%bd%d0%b0%d0%b4%d0%be-2/)󠁿

 [site4sale](https://profiles.wordpress.org/site4sale/) 4 rugsėjo, 2023

Большое спасибо из России за качественный плагин.Установил на несколько сайтов.

![](https://secure.gravatar.com/avatar/c93f3c825e795aec2409aff8aef3b672d313124fe446c1ac44301b513154cd71?
s=60&d=retro&r=g)

### 󠀁[exceptionally easy and powerful](https://wordpress.org/support/topic/exceptionally-easy-and-powerful/)󠁿

 [rjacob999](https://profiles.wordpress.org/rjacob999/) 17 rugsėjo, 2022

does the job; EXCELLENT! thanks 🙂

![](https://secure.gravatar.com/avatar/93a918c9098e74ebad71da109043e267c02e3e342008c523b739ff428cd926ba?
s=60&d=retro&r=g)

### 󠀁[French translation](https://wordpress.org/support/topic/french-translation-229/)󠁿

 [bibi699depreau](https://profiles.wordpress.org/bibi699depreau/) 2 gegužės, 2020
1 reply

Addressed to the author of the plugin : Hello, French, and occasional voluntary 
developer for associations, I discovered your plugin „custom upload dir” which I
found very interesting. Like me, many French people of my generation, (soon to be
in their seventies) have limited use of English. So I made a translation of the 
plugin which, for information, works very well with PHP 5.6.4 and WordPress 5.4 –
en_FR You will find attached the plugin with the translation.

![](https://secure.gravatar.com/avatar/8e8d22af51068862c357afc1ec30c4f2dc6f03a6cd6eaf7ba745d9ffaea6ef18?
s=60&d=retro&r=g)

### 󠀁[Useful custom folder upload yyyy/mm/dd](https://wordpress.org/support/topic/useful-custom-folder-upload-yyyy-mm-dd/)󠁿

 [nhantam](https://profiles.wordpress.org/nhantam/) 6 rugsėjo, 2019

Very useful & convenient to manage images in the long run if your website posts 
a lot of images

![](https://secure.gravatar.com/avatar/0d19a7576055730dfd5145fd9bddbb374e65db6f84bd8109e3fd26fab9257e93?
s=60&d=retro&r=g)

### 󠀁[not working at all with imports](https://wordpress.org/support/topic/not-working-at-all-with-imports/)󠁿

 [holamediasolutions](https://profiles.wordpress.org/holamediasolutions/) 29 birželio,
2019

Dosnt work when you import export post or products

![](https://secure.gravatar.com/avatar/f8aa7ca13475c8964d3de91c8062905e7ecb636b32d619021d2de52660d6939c?
s=60&d=retro&r=g)

### 󠀁[Perfect! Very fast support](https://wordpress.org/support/topic/perfect-very-fast-support/)󠁿

 [Jabe](https://profiles.wordpress.org/jabe/) 24 kovo, 2019

Does perfectly what it’s supposed to do. Used it for years, then it was broken after
Gutenberg update, I reported it in the forum and the developer fixed it on the following
day. Those options should be included by default in WordPress to really customize
it.

 [ Perskaityti visus atsiliepimus (25) ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/)

## Programuotojai ir komandos nariai

“Custom Upload Dir” yra atviro kodo programa. Prie jos sukūrimo prisidėję žmonės
surašyti toliau.

Autoriai

 *   [ ulfben ](https://profiles.wordpress.org/ulfben/)

[Išverskite “Custom Upload Dir” į savo kalbą.](https://translate.wordpress.org/projects/wp-plugins/custom-upload-dir)

### Domina programavimas?

[Peržiūrėkite kodą](https://plugins.trac.wordpress.org/browser/custom-upload-dir/),
naršykite [SVN repozitorijoje](https://plugins.svn.wordpress.org/custom-upload-dir/),
arba užsiprenumeruokite [kodo pakeitimų žurnalą](https://plugins.trac.wordpress.org/log/custom-upload-dir/)
per [RSS](https://plugins.trac.wordpress.org/log/custom-upload-dir/?limit=100&mode=stop_on_copy&format=rss).

## Pakeitimų istorija

#### Changelog v. 3.4.5 (2020-05-05)

 1. added french translation (thanks, bibi699depreau!)

#### Changelog v. 3.4.4 (2019-03-24)

 1. Fixed a few PHP warnings
 2. Removed the %permalink% template as it broke uploads to drafts.

#### Changelog v. 3.4.3.2 (2019-03-24)

 1. Fixed ‘upload_dir’ not providing $post_id in Gutenberg editor.

#### Changelog v. 3.4.1 (2015-03-16)

 1. Added [filter ‘cud_generate_path’](https://wordpress.org/plugins/custom-upload-dir/installation/)
    so you can easily adjust the path with any variable you want.
 2. Added %mime_type% to sort files by mime type
 3. Added %author_role% to sort files by author role.
 4. Coming: support for per-post-type settings. Eg: every post type can have their 
    own rules for where to place uploads. Currently missing the admin interface. If
    you feel like helping out, let me know.

#### Changelog v. 3.4 (2013-02-09)

 1. Added %file_ext% to sort by file type
 2. Added [tentative support for uploads from WordPress apps](https://wordpress.org/support/topic/search-and-mobile-apps-compatibility?replies=6#post-3837193).
 3. Removed setting for „Base upload folder” as WP core no longer exposes this
 4. Cleared out some PHP error on the admin page
 5. Fixed leaking CSS on admin page

#### Changelog v. 3.3.2 (2011-12-29)

 1. Updated init to use WordPress API properly
 2. Removed dead code

#### Changelog v. 3.3.1 (2011-12-27)

 1. Fixed poor sanitization of post slugs (%post_name%)
 2. Added %post_parent%
 3. Fixed settings not always initializing

#### Changelog v. 3.3 (2011-12-18)

 1. Support for WordPress 3.3
 2. Support for tags and categories
 3. Support for custom taxonomies
 4. Added %current_user%, %permalink%
 5. Added all permalink tags
 6. Added test-function to admin page

#### Changelog v. 3.0.2 (2011-07-29)

 1. Fix for post_author not working
 2. Fix timestamps from the media uploader ([thanks; alx359](https://wordpress.org/support/topic/plugin-custom-upload-dir-unattached-images-upload-to-19700101?replies=8))

**Changelog v. 3.0.1 (2010-11-01)**

 1. [Fix for „undefined function get_userdata()”](https://wordpress.org/support/topic/plugin-custom-upload-dir-fatal-error-call-to-undefined-function-get_userdata)(
    thanks somatic!)

**Changelog v. 3.0 (2010-10-21)**

 1. Rewrote entire plugin for WordPress 3.0
 2. A slew of new placeholders for building path’s with
 3. A new interface to allow arbitrary strings in path
 4. Error messages when uploading to un-named or un-dated posts
 5. Added translation support

**Changelog v.2.5.4 (2008-12-31)**

 1. Adjusted the test case. (Pedja)

**Changelog v.2.5.3 (2008-12-30)**

More problems have crept up due to the [massive amount of dry runs of ‘upload_dir’](https://trac.wordpress.org/ticket/8753)
in WP 2.7.

 1. Added quick bail for every call that’s not for a file upload. (props to Pedja Ljubomirovic(
    Canada))

**Changelog v.2.5.2 (2008-12-15)**

 1. Fixed problem with plugin blocking deletion/editing of attached files.

**Changes in v.2.5.1 (2008-12-14)**

 1. Fixed Custom Upload Dir breaking WP 2.7 when called from the loop

**Changes in v.2.5 (2008-11-15)**

 1. Support for WP 2.7-beta1
 2. Added ‘post_author’
 3. Fixed ‘post_title’ (broken since WP 2.4)
 4. Fixed issue with use_yearmonth overriding post date
 5. Tons of small(ish) updates
 6. Removed Mediacaster-support

**Changes in v.2.0** (2007-10-19)

 1. Mediacaster compability.
 2. Added proper configuration screen
 3. Massive code overhaul
 4. Name change (previously „Daily Upload Dir”)

## Metainformacija

 *  Version **3.4.6**
 *  Atnaujinta **prieš 4 metai**
 *  Aktyvių instaliacijų **5 000+**
 *  WordPress versija ** 3.9 ar naujesnė **
 *  Ištestuota iki **6.0.11**
 *  PHP versija ** 5.2 ar naujesnė **
 *  Kalba
 * [English (US)](https://wordpress.org/plugins/custom-upload-dir/)
 * Žymos
 * [files](https://lt.wordpress.org/plugins/tags/files/)[media](https://lt.wordpress.org/plugins/tags/media/)
   [organize](https://lt.wordpress.org/plugins/tags/organize/)[upload](https://lt.wordpress.org/plugins/tags/upload/)
 *  [Daugiau](https://lt.wordpress.org/plugins/custom-upload-dir/advanced/)

## Įvertinimai

 4.4 out of 5 stars.

 *  [  21 5-star reviews     ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/?filter=3)
 *  [  1 2-star review     ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/?filter=2)
 *  [  3 1-star reviews     ](https://wordpress.org/support/plugin/custom-upload-dir/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-upload-dir/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/custom-upload-dir/reviews/)

## Autoriai

 *   [ ulfben ](https://profiles.wordpress.org/ulfben/)

## Pagalba

Turite pastabų? Reikia pagalbos?

 [Peržiūrėti pagalbos forumą](https://wordpress.org/support/plugin/custom-upload-dir/)

## Paremkite

Galbūt norite padėti plėtoti šį įskiepį?

 [ Paremti įskiepio kūrimą ](https://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=21&y=17)