[uploader, development sugar] Automatic upload folder detection [5.2.2-B1]
The "kDBItem" class of In-Portal is used to describe 1 record in the database table. For each field in a table a two-way transformation can be applied to transform value from storage format (used in database) to human format (used on web page) and back.
One of transformation in question is file uploading process. To make it work the mandatory "upload_dir
" field option needs to be specified for indicating folder where uploaded file would be stored.
Unfortunately during development process, when units are copy/pasted to easily create more units it happens, that "upload_dir
" field option contains value from copied unit and that results in mixing files from different non-related units into same folders.
Solution
In the "kUploadFormatter::PrepareOptions" method when "upload_dir" option is missing and "kUploadFormatter::$DestinationPath" property is empty set it by combining "WRITEBALE_BASE" constant and unit folder.