If this is set, files will be referenced relative to the path of the file they were uploaded to.
For example, if paths.uploads is configured as [base_path]/images and you upload image.jpg to /blog/my-post.md, the path will be saved as images/image.jpg.
In the same scenario, if you select an existing image /siteicon.png, the path will be saved as ../siteicon.png.
Uploads paths have a number of placeholders available, depending on whether you are configuring the upload directory (with path.uploads or path.dam_uploads) or the upload filename (with path.uploads_filename or path.dam_uploads_filename).
There are two types of placeholders: file and data placeholders.
File placeholders are always available, and relate to the file the editor is open on:
[collection] is the collection key the file is assigned to.
[path] is the full path of the file, relative to site source.
[base_path] is the path of the file excluding filename, relative to site source.
[slug] is the filename, excluding extension. Is an empty string if this results in "index".
[filename] is the filename, including extension.
[ext] is the last extension.
[relative_path] is the full path of the file, relative to the collection path.
[relative_base_path] is the path of the file excluding filename, relative to the collection path.
[full_slug] is an alias for [relative_base_path]/[slug].
Data placeholders are populated from front matter or data values in the editor, and support a number of filters:
{title} is the title from inside the file.
{id} is the id from inside the file.
{title|lowercase} is title from inside the file, lower cased.
{category|slugify} is category from inside the file, slugified.
{tag|slugify|uppercase} is tag from inside the file, slugified, then upper cased.
{date|year} is date from inside the file, with the 4-digit year extracted.
{date|month} is date from inside the file, with the 2-digit month extracted.
{date|day} is date from inside the file, with the 2-digit day extracted.
The placeholders are processed when the new asset is added. This means that changes to front matter or data after adding an asset file are not updated for that processed upload path.
[asset_filename] is the full name of uploaded file (e.g. "my-document.pdf").
[asset_filename_without_ext] is filename without any extension (e.g. "my-document").
[asset_ext] is the file's extension without a "." (e.g. "png").
[count] becomes a hyphen and number if the processed file path clashes with an existing file (e.g. my-document-1.pdf)
You can use filters to transform these placeholders. For example [asset_filename|slugify].[asset_ext] will convert "My Document.pdf" into "my-document.pdf". You can read more about using placeholders, and see a list of all available filters, in this article.
Placeholders that result in empty values may result in sequential slashes — these are collapsed into one after applying placeholders.
The uploads_dir option and legacy placeholders are an old configuration that we have since improved on. These are backwards compatible so there's no need to change anything. If you do want to update, the legacy placeholders and their new equivalents are: