Download all the files stored in Mendix.

0
Hello to all. I have a doubt regarding one requirement that I want to implement in a application that is deployed on Mendix. The Idea is to download a copy of all the files that were uploaded to the Website but without losing the name convention that was assigned to that file when it was uploaded. I tried downloading the file-only backup from the developer portal but the files are downloaded with a generic ID as their name. My question is: Is there a way to do this without losing the name convention? is important to mention that there are more than 5000 files! Thank you very much in advance for the help.  
asked
4 answers
1

Yes, but you would need to do it in another way. When you download the files they have the name within the Mendix database and that database also holds the original name of the file. Either use the SFTP module so you can export all the files to some SFTP server.

You also use one of the zip modules in the marketplace. You could then create a mciroflow that retrieves batches of files, put them in a zip and then directly download that file.  if you restore the full database locally and then create those zips they are already in a nice format to hand over to the other party or if this process needs to be done on a regular basis you could make a form where the end user could select the files in the cloud.

Hope this helps a bit.

Regards,

Ronald

 

answered
0

Although you have 5000 files to download, these are likely only one or a couple of filedocument-specializations. You can create a download function  for each of them, using the download widget.

answered
0

Did you get any solution for your issue. I also have the same issue of downloading all attachments


answered
0

Hi,

This is expected behavior in Mendix.

When files are stored, Mendix saves them internally with a UUID-based filename, and the original filename is stored separately in:

System.FileDocument.Name

So when you download from backup or file storage, you will always get system-generated names, not the original ones.

There is no out-of-the-box way in Mendix to download all files with original names.

To achieve this, you must reconstruct the files using application logic.

Approach: Generate a ZIP with original filenames

Steps:

  1. Retrieve all FileDocuments
Retrieve → System.FileDocument (or your custom file entity)

  1. Create a ZIP FileDocument
Create Object → System.FileDocument
Name = 'AllFiles.zip'

  1. Use a Java action to build the ZIP

This is required because:

  • Mendix does not support ZIP creation in microflows
  • Community Commons does not provide this functionality

Inside Java:

  • Read file content using:
Core.getFileDocumentContent()

  • Get original filename using:
Name attribute

  • Write into ZIP using:
ZipOutputStream

  1. Return ZIP and download
Download File → ZipFile

Why this is required

  • Files in storage → UUID names
  • Original names → only in database
  • Only way to preserve names → read + recreate files manually

for 5000+ files

  • Use streaming (ZipOutputStream) to avoid memory issues
  • Do not attempt individual downloads
  • Consider batching if files are very large


  • Mendix backup/download → cannot preserve original filenames
  • No standard module provides this feature
  • Correct and scalable solution → custom Java action to generate ZIP using FileDocument.Name


answered