Commit 1bb4cea6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Multiple & Advanced Upload:

- fix problem when more than one file uploaded - there was only one variable {{_filename}}, which was not sufficient for more than one upload element per form. New: {{_filename_<FE_NAME>:FE:allbut}}.
- implemented {{_deleted_<FE_NAME>:F0}}: if exist and is '1', than this means that the previous uploaded file has been trashed through the user by clicking on the trash.

Index.rst: update doc. Some more notes are needed. See one of the upcomming commits.
Constants.php: Renamed CLIENT_UPLOAD_FILENAME and created CLIENT_FILE_DELETED.
parent 6bb97e4c
......@@ -251,7 +251,8 @@ const CLIENT_UPLOAD_FE_NAME = 'name';
const CLIENT_SIP_FOR_FORM = '_sipForForm';
const CLIENT_FE_NAME = '_feName';
const CLIENT_UPLOAD_FILENAME = '_filename';
const CLIENT_UPLOAD_FILENAME = '_filename_'; // will be extended by 'formElement[FE_name]'. E.g. '_filename_pathFileName1'
const CLIENT_FILE_DELETED = '_deleted_'; // will be extended by 'formElement[FE_name]'. E.g. '_deleted_pathFileName1'=0|1
// ALL $_SERVER variables:
// The following exist and might be the most used ones.
......@@ -272,6 +272,7 @@ class Save {
// Delete existing old file.
if (isset($statusUpload[FILES_FLAG_DELETE]) && $statusUpload[FILES_FLAG_DELETE] == '1') {
$this->store->setVar(CLIENT_FILE_DELETED . $formElement[FE_NAME], '1', STORE_FORM);
$arr = $sip->getVarsFromSip($sipUpload);
if (file_exists($oldFile)) {
......@@ -315,7 +316,7 @@ class Save {
// Provide variable '_filename'. Might be substituted in $formElement[FE_PATH_FILE_NAME].
$origFilename = Sanitize::safeFilename($statusUpload[FILES_NAME]);
$this->store->setVar(CLIENT_UPLOAD_FILENAME, $origFilename, STORE_FORM);
$this->store->setVar(CLIENT_UPLOAD_FILENAME . $formElement[FE_NAME], $origFilename, STORE_FORM);
$pathFileName = $this->evaluate->parse($formElement[FE_FILE_DESTINATION]);
Supports Markdown
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