# Mecha CMS

Configure custom image upload path for neat file structure.

Did you know that our CKEditor extension has ability to set custom image upload path? By default, the uploaded images will be stored in the ASSET folder, in a folder named as the image file extension. This is the default location path where the image will be stored if we upload an image named as Picture (Copy 1).jpg:

.\lot\asset\jpg\picture-copy-1.jpg

The default image upload path setting can be found in the configuration file. Open .\lot\extend\c-k-editor\lot\state\config.php to customize:

<?php

return [
…
…
];

Some candy syntax are available to customize the filebrowserImageUploadPath property:

SyntaxValue
%‌{‌date‌}‌%A Date instance with its properties.
%‌{‌extension‌}‌%The current file extension.
%‌{‌hash‌}‌%Random string generated by Guard::hash().
%‌{‌id‌}‌%Unique ID generated by PHP uniqid().
%‌{‌name‌}‌%The current file name without file extension.

So, for example, if you set the filebrowserImageUploadPath to lot/asset/foo/bar/%‌{‌name‌}‌%.%‌{‌extension‌}‌%, then the image you have uploaded will be stored as:

.\lot\asset\foo\bar\picture-copy-1.jpg

And if you set the filebrowserImageUploadPath to lot/asset/foo/bar/%‌{‌id‌}‌%.%‌{‌extension‌}‌%, then the image you have uploaded will be stored as:

.\lot\asset\foo\bar\5a6d4215e1e65.jpg

And this is how to set the configuration value so that the uploaded images will be automatically stored by the file upload date:

<?php

return [
…
…
];
.\lot\asset\2018-01-28\picture-copy-1.jpg