diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index 49abd8ab30dbd27e2af43e37dd1ab6569763c20a..91db1d74ecd5271ff943e33d809301510d2faa5f 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -1307,7 +1307,11 @@ Store: *VARS* - V +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | filename | Original filename of an uploaded file via an 'upload'-FormElement. Valid only during processing of the current 'upload'-formElement. | +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ - | fileDestinaton | Destination (path & filename) for an uploaded file. Defined in an 'upload'-FormElement.parameter. Valid: same as 'filename'. | + | fileDestination | Destination (path & filename) for an uploaded file. Defined in an 'upload'-FormElement.parameter. Valid: same as 'filename'. | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ + | filenameBase | Like 'filename', but without the extension (if there is one) | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ + | filenameExt | Only the extension of 'filename' (if there is one) | +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ .. _STORE_LDAP: diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 3b80fce8f4e4a73426e55e585d5b68638e16d919..2beb28f3c07bc4e98eccf56699b8e71c9777cef8 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -532,6 +532,8 @@ const VAR_RANDOM = 'random'; const VAR_FILE_DESTINATION = 'fileDestination'; const VAR_SLAVE_ID = ACTION_KEYWORD_SLAVE_ID; const VAR_FILENAME = 'filename'; // Original filename of an uploaded file. +const VAR_FILENAME_BASE = 'filenameBase'; // Original filename of an uploaded file, without the extension. +const VAR_FILENAME_EXT = 'filenameExt'; // Extension of the original filename of an uploaded file, . // PHP class Typeahead const TYPEAHEAD_API_QUERY = 'query'; // Name of parameter in API call of typeahead.php?query=...&s=... - See also FE_TYPE_AHEAD_SQL diff --git a/extension/qfq/qfq/Save.php b/extension/qfq/qfq/Save.php index 9a2e3de5b7209396023d59f99109bceb465678ea..acafc78d88539250b4e16d1394aa1d917d846508 100644 --- a/extension/qfq/qfq/Save.php +++ b/extension/qfq/qfq/Save.php @@ -402,7 +402,14 @@ class Save { // Provide variable 'filename'. Might be substituted in $formElement[FE_PATH_FILE_NAME]. $origFilename = Sanitize::safeFilename($statusUpload[FILES_NAME]); + $pathParts = pathinfo($origFilename); $this->store->setVar(VAR_FILENAME, $origFilename, STORE_VAR); + if (isset($pathParts['filename'])) { + $this->store->setVar(VAR_FILENAME_BASE, $pathParts['filename'], STORE_VAR); + } + if (isset($pathParts['extension'])) { + $this->store->setVar(VAR_FILENAME_EXT, $pathParts['extension'], STORE_VAR); + } $pathFileName = $this->evaluate->parse($formElement[FE_FILE_DESTINATION]);