How can I store a System.FileDocument file in the app’s deployment folder directly?

0
Hi everyone,I am working on a Mendix application and I want to understand whether it is possible to store uploaded files directly in the app’s deployment folder instead of keeping them in the normal Mendix file storage.My requirement is:Upload a file in MendixSave it physically inside the app folder, for example under deployment/data/files or another folder inside deploymentAccess that file directly from the application laterI would like to know:Is this supported in Mendix?Can we move or copy a System.FileDocument file to a custom folder inside deployment using Java actions?Is this approach safe for local as well as cloud deployments?If this is not recommended, what is the correct Mendix way to handle this requirement?From the Mendix documentation, I understand that System.FileDocument contents are stored in file storage, outside the database, and that local deployments use a file storage location under the runtime/deployment data area. Mendix also documents restoring files into deployment/data/files for local environments, which makes me unsure whether custom app logic should write files there directly. I want to confirm whether writing files directly to the deployment folder is a valid approach, or whether I should use standard FileDocument storage / external blob storage instead. Mendix documentation for cloud environments also says System.FileDocument contents are stored in blob file storage buckets, which suggests the deployment folder may not be the right place in production. Thanks in advance.
asked
1 answers
0

Not recommended.


The deployment folder is not stable. It can be wiped or replaced during redeployment, so your files can be lost. It also doesn’t work reliably in cloud environments.


Even if you do it with Java locally, it’s not a safe design.


Use System.FileDocument or external storage. I’d recommend AWS S3 for this.


If this resolves your issue, you can mark it as accepted.


answered