Where will the files get stored in Mendix?

0
Hi In cloud, the file will be stored in S3, so it will not be a problem. But , how in local or on-prem, where will it stored? Possibility 1: The details alone will be stored in DB and the file will be stored as binary in deployment folder. Problem: Even if i delete the deployment folder, the file is still there in the application.   Possibility 2: The file itself stored as binary in DB itselft Problem: It will increase my db size and what is the ratio of uploaded file size and increased DB size. Eg., 100MB of file upload will increase my DB size by 30MB.     Thanks in advance.
asked
2 answers
1

In Mendix, uploaded files (anything inheriting from System.FileDocument) are not stored in the database. The DB only keeps metadata (name, size, content-type, ID etc). Actual file is stored at path which can be configurable.

 

If deployed locally, files can be found in the deployment directory of your project under data/files. If deployed to Mendix Cloud, files are stored in managed file storage (backed by Amazon S3) automatically.

 

You can change the file location; for Local (Studio Pro / running from IDE):

Project > Settings > Configurations > Server > Extra Runtime Settings. Then add the following:

   UploadedFilesPath = C:\MendixFiles

 

For on prem windows server add the same config to: Service Console > Advanced > Custom Runtime Settings

answered
1

Hi Rishi,

 

All the Mendix objects declared as a specialization of "System.FileDocument" are stored as files/blob objects. In local it will be in the deployment folder, in cloud, it will be a part of Volume storage.

 

If your query is about deleting the files, the only "graceful" way to delete is within the Mendix application. This is because each file has a reference name which has to be correctly maintained between System.FileDocument and the file blob tree strucuture.

 

Case 1 : When you delete the file in the /deployment directory, that becomes a missing reference in the System.FileDocument table. This can be a case of missing file object.

 

Case 2 : When restore "only DB" from some other env., the are some invalid references which are part of the System.FileDocument table which do not exist in the env. (cloud be /deployment folder or a volume storage if its a cloud env.)

 

Your possibility 2 is not a good way to store file in the database. It can cause performance issue in the database.

 

So the only way to manage it is to design correct lifecycle of a file within the Mendix application so that references remain valid and the database remains with valid file references

 

https://docs.mendix.com/developerportal/operate/restore-backup/#tree-folder

answered