You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ This plugin can be consumed by the CAP application deployed on BTP to store thei
15
15
- Display attachments specific to repository: Lists attachments contained in the repository that is configured with the CAP application.
16
16
- Custom properties : Provides the capability to define custom properties for attachments.
17
17
- Maximum allowed uploads: Provides the capability to define the maximum number of uploads allowed for the user.
18
+
- Maximum file size: Provides the capability to specify the maximum file size for attachments.
18
19
- Multiple attachment facets: Provides the capability to define multiple attachment facets/sections in the CAP Entity.
19
20
- Technical user support: Provides the capability to consume the plugin using technical user.
20
21
- Copy attachments: Provides the capability to copy attachments from one entity to another entity.
@@ -34,6 +35,7 @@ This plugin can be consumed by the CAP application deployed on BTP to store thei
34
35
-[Support for Multitenancy](#support-for-multitenancy)
35
36
-[Support for Custom Properties](#support-for-custom-properties)
36
37
-[Support for Maximum allowed uploads](#support-for-maximum-allowed-uploads)
38
+
-[Support for Maximum File Size](#support-for-maximum-file-size)
37
39
-[Support for Multiple attachment facets](#support-for-multiple-attachment-facets)
38
40
-[Support for Technical user](#support-for-technical-user)
39
41
-[Support for Copy attachments](#support-for-copy-attachments)
@@ -492,6 +494,35 @@ SDM.maxCountErrorMessage = Maximale Anzahl von Anhängen erreicht
492
494
>
493
495
> Once the maxCount is configured, it is recommended not to alter it. If the maxCount is altered, the previously uploaded documents will still be visible.
494
496
497
+
## Support for Maximum File Size
498
+
499
+
This plugin allows you to customize the maximum file size for attachments that a user can upload. Once the defined file size limit is exceeded, the upload is rejected and an error is triggered. The error message displayed to the user is fully customizable. The `@Validation.Maximum` annotation is used to define the maximum allowed file size.
500
+
501
+
Refer the following example from a sample Bookshop app:
502
+
503
+
```cds
504
+
505
+
entity Books {
506
+
...
507
+
attachments: Composition of many Attachments;
508
+
}
509
+
510
+
annotate Books.attachments with {
511
+
content @Validation.Maximum : '30MB';
512
+
}
513
+
```
514
+
515
+
#### Customizing the Maximum File Size Error Message
516
+
517
+
To customize the error message displayed when the file upload size limit is exceeded, add the following key to your `messages.properties` file under `srv/src/main/resources`:
518
+
519
+
```properties
520
+
AttachmentSizeExceeded = File size exceeds the limit of {0}.
521
+
```
522
+
523
+
Supports both decimal (KB, MB, GB, TB) and binary (KiB, MiB, GiB, TiB) units with comprehensive validation and error handling.
524
+
525
+
495
526
## Support for Multiple attachment facets
496
527
The plugin supports creating multiple attachment facets or sections, each allowing various documents to be uploaded. The names of these facets are fully customizable. All existing operations available for the default attachment facet are also supported for any additional facets you create.
497
528
@@ -1316,4 +1347,4 @@ We as members, contributors, and leaders pledge to make participation in our com
1316
1347
1317
1348
## Licensing
1318
1349
1319
-
Copyright 2024 SAP SE or an SAP affiliate company and <your-project> contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/cap-java/sdm).
1350
+
Copyright 2024 SAP SE or an SAP affiliate company and <your-project> contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/cap-java/sdm).
0 commit comments