Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
e1f7510e
Commit
e1f7510e
authored
Dec 10, 2018
by
Marc Egger
Browse files
Save.php: Fixed exception (file size, mime type) for non-existing uploads
parent
75e02951
Pipeline
#1116
passed with stage
in 1 minute and 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/Save.php
View file @
e1f7510e
...
...
@@ -327,6 +327,14 @@ class Save {
/**
* Process all Upload Formelements for the given $recordId. After processing &$formValues will be updated with the
* final filenames.
*
* Constellation: # FILE OLD FILE NEW FILESIZE
* 1 none none
* 2 none new
* 3 exist no change
* 4 delete none
* 5 delete new
*
* @param $recordId
* @throws CodeException
* @throws DbException
...
...
@@ -339,6 +347,7 @@ class Save {
$sip
=
new
Sip
(
false
);
$newValues
=
array
();
$vars
=
array
();
$formValues
=
$this
->
store
->
getStore
(
STORE_FORM
);
$primaryRecord
=
$this
->
store
->
getStore
(
STORE_RECORD
);
// necessary to check if the current formElement exist as a column of the primary table.
...
...
@@ -362,10 +371,27 @@ class Save {
$column
=
$formElement
[
FE_NAME
];
$pathFileName
=
$this
->
doUpload
(
$formElement
,
$formValues
[
$column
],
$sip
,
$modeUpload
);
$pathFileNameTmp
=
empty
(
$pathFileName
)
?
$primaryRecord
[
$column
]
:
$pathFileName
;
if
(
$modeUpload
==
UPLOAD_MODE_DELETEOLD
&&
$pathFileName
==
''
){
$pathFileNameTmp
=
''
;
// see '4'
}
else
{
if
(
empty
(
$pathFileName
))
{
$pathFileNameTmp
=
$primaryRecord
[
$column
];
// see '3'
}
else
{
$pathFileNameTmp
=
$pathFileName
;
// see '1,2,5'
}
}
// Get latest file information
$vars
=
HelperFile
::
getFileStat
(
$pathFileNameTmp
);
$this
->
store
->
appendToStore
(
$vars
,
STORE_VAR
);
if
(
$pathFileNameTmp
==
''
)
{
// No new upload and no existing: take care to remove previous upload file statistics.
$this
->
store
->
unsetVar
(
VAR_FILE_MIME_TYPE
,
STORE_VAR
);
$this
->
store
->
unsetVar
(
VAR_FILE_SIZE
,
STORE_VAR
);
}
else
{
$vars
=
HelperFile
::
getFileStat
(
$pathFileNameTmp
);
$this
->
store
->
appendToStore
(
$vars
,
STORE_VAR
);
}
// If given: fire a sqlBefore query
$this
->
evaluate
->
parse
(
$formElement
[
FE_SQL_BEFORE
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment