November 15, 2023

Custom Storage Options for Efficient File Management

EspoCRM provides robust functionality for managing customer data, interactions, and relationships. One key aspect of this functionality is the ability to store and manage various file attachments associated with records. While EspoCRM comes with a default file storage mechanism in the data/upload directory, developers have the flexibility to customize the storage solution to better suit their needs.

Default File Storage

EspoCRM stores all uploaded files, including attachments, in the data/upload directory. This setup is suitable for many use cases, but as organizations grow and their data storage requirements evolve, there may be a need to integrate external storage solutions for improved scalability, reliability, and performance.

Amazon S3 Integration

EspoCRM seamlessly integrates with Amazon Simple Storage Service (S3), a scalable and secure object storage solution. To enable AWS S3 support, developers need to configure the parameters in the data/config-internal.php and data/config.php files.

Configuration in data/config-internal.php

'awsS3Storage' => [ 'bucketName' => 'BUCKET_NAME', 'path' => 'OPTIONAL_PATH_WHERE_FILES_WILL_BE_STORED', 'credentials' => [ 'key' => 'KEY', 'secret' => 'SECRET', ], 'region' => 'YOUR_REGION', ],

Configuration in data/config.php

'defaultFileStorage' => 'AwsS3',

Credentials for AWS S3 can be omitted from the configuration, in which case they will be read from the environment. This flexibility simplifies the setup process, allowing for a smooth integration with AWS S3.

Disabling Image Thumbnail Caching

When using external file storage, it is recommended to disable caching for image thumbnails. This can be achieved by adding the following configuration to the data/config.php file:

'thumbImageCacheDisabled' => true,

Moving Existing Attachments to External Storage

After setting up an external file storage solution, existing attachments remain stored locally in the data/upload directory. To migrate these attachments to the new storage, developers can manually move the files and execute the following SQL query:

UPDATE `attachment` SET `storage` = '{StorageName}'

{StorageName} is the name of the storage, e.g., AwsS3. This query updates the storage reference for existing attachments, ensuring they are seamlessly transitioned to the new storage solution.

Conclusion

Customizing file storage in EspoCRM provides organizations with the flexibility to choose the most suitable storage solution for their evolving needs. Whether integrating with AWS S3 or implementing a custom storage provider, EspoCRM’s extensibility allows for efficient and scalable file management, enhancing the overall CRM experience for businesses of all sizes.

If your organization is considering the switch to an external file storage solution for EspoCRM and requires expert guidance to implement this transition, our team of experienced professionals is here to assist you. Contact us using the form below to initiate a consultation and order a personalized proposal.

You can find more information about EspoCRM in official documentation.

Recent posts

Table of Contents

Unlock Your

25% Discount

Sign up and use code BLACKWEEK for an instant discount!
Click here to get more information.

Skip to content