Commit 10e4a0e4 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature 4901 / PDF Split: Preparation - new STORE_VAR variable...

Feature 4901 / PDF Split: Preparation - new STORE_VAR variable {{filenameBase:V}}, {{filenameExt:V}}
parent 7de0d4e3
......@@ -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:
......
......@@ -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
......
......@@ -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]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment