Skip to content
Snippets Groups Projects
Commit 81e4d5ef authored by dirnbauer's avatar dirnbauer Committed by Daniel Siepmann
Browse files

[DOCS] Add example for saving uploaded files in SaveToDatabase finisher

This adds an example on how to save uploaded files in ext:news'
`sys_file_reference` columns.

Releases: master, 9.5
Resolves: #89775
Change-Id: Id775a59ee7f39446f5b0046a486861566cfa28ac
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62431


Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarBjörn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Tested-by: default avatarBjörn Jacob <bjoern.jacob@tritum.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
parent cb0252a6
Branches
Tags
No related merge requests found
......@@ -81,6 +81,87 @@ SaveToDatabase finisher
The 'SaveToDatabase finisher' saves the data of a submitted form into a
database table.
Here is an example for adding uploads to ext:news (fal_related_files and fal_media).
.. code-block:: yaml
-
identifier: SaveToDatabase
options:
-
table: tx_news_domain_model_news
mode: insert
elements:
my-field:
mapOnDatabaseColumn: bodytext
imageupload-1:
mapOnDatabaseColumn: fal_media
fileupload-1:
mapOnDatabaseColumn: fal_related_files
databaseColumnMappings:
pid:
value: 3
tstamp:
value: '{__currentTimestamp}'
datetime:
value: '{__currentTimestamp}'
crdate:
value: '{__currentTimestamp}'
hidden:
value: 1
-
table: sys_file_reference
mode: insert
elements:
imageupload-1:
mapOnDatabaseColumn: uid_local
skipIfValueIsEmpty: true
databaseColumnMappings:
table_local:
value: sys_file
tablenames:
value: tx_news_domain_model_news
fieldname:
value: fal_media
tstamp:
value: '{__currentTimestamp}'
crdate:
value: '{__currentTimestamp}'
showinpreview:
value: 1
uid_foreign:
value: '{SaveToDatabase.insertedUids.0}'
-
table: sys_file_reference
mode: insert
elements:
fileupload-1:
mapOnDatabaseColumn: uid_local
skipIfValueIsEmpty: true
databaseColumnMappings:
table_local:
value: sys_file
tablenames:
value: tx_news_domain_model_news
fieldname:
value: fal_related_files
tstamp:
value: '{__currentTimestamp}'
crdate:
value: '{__currentTimestamp}'
uid_foreign:
value: '{SaveToDatabase.insertedUids.0}'
-
table: sys_file_reference
mode: update
whereClause:
uid_foreign: '{SaveToDatabase.insertedUids.0}'
uid_local: 0
databaseColumnMappings:
pid:
value: 0
uid_foreign:
value: 0
.. _concepts-finishers-translation:
......
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