Skip to content

Commit

Permalink
NEW DB column showing if file is userform upload
Browse files Browse the repository at this point in the history
- UserFormUpload used by File::isTrackedFormUpload()
  • Loading branch information
emteknetnz committed May 24, 2020
1 parent 45489fa commit 5835597
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _config/extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ Name: userformsextensions
SilverStripe\UserForms\Model\UserDefinedForm:
extensions:
UpgradePolymorphicExtension: SilverStripe\UserForms\Extension\UpgradePolymorphicExtension
SilverStripe\Assets\File:
extensions:
- SilverStripe\UserForms\Extension\UserFormFileExtension
2 changes: 2 additions & 0 deletions code/Control/UserDefinedFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use SilverStripe\ORM\ValidationException;
use SilverStripe\ORM\ValidationResult;
use SilverStripe\Security\Security;
use SilverStripe\UserForms\Extension\UserFormFileExtension;
use SilverStripe\UserForms\Form\UserForm;
use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
Expand Down Expand Up @@ -257,6 +258,7 @@ public function process($data, $form)
$upload = Upload::create();
$file = File::create();
$file->ShowInSearch = 0;
$file->UserFormUpload = UserFormFileExtension::USER_FORM_UPLOAD_TRUE;
try {
$upload->loadIntoFile($_FILES[$field->Name], $file, $foldername);
} catch (ValidationException $e) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
}
],
"require": {
"php": ">=7.1",
"silverstripe/cms": "^4.0",
"symbiote/silverstripe-gridfieldextensions": "^3.1",
"silverstripe/segment-field": "^2.0",
Expand Down

0 comments on commit 5835597

Please sign in to comment.