In Strapi 5, the process is the same as Martin Larizzate described, but the property names are different:
files: { filepath: filePath, originalFilename: fileName, mimetype: mime.getType(filePath), size: stats.size, }