How to Override Inbuilt Upload Function to Directly Upload to S3?

Hi everyone,

I need to override the inbuilt file upload function in Frappe to upload files directly to an S3 bucket instead of storing them in the database or local file system.

Could anyone guide me on how to achieve this?

  • Which function should I override?
  • Any recommended approach for handling file metadata in Frappe while storing the actual files in S3?

Any help or example code would be appreciated!

Simple app: Frappe S3 Attachment | Frappe Cloud Marketplace

The above app should be fine for most cases. It does send the file to frappe server first and from there uploads to s3.

For cases where the file needs to be directly uploaded from browser to s3, use the Presigned URL Presigned URLs - Boto3 1.37.0 documentation

Create frappe endpoint that validates the request and responds with presigned url, use the url from browser to upload file to s3. Make sure S3 policies and networking between server, browser and s3 is correct.

If I install the above app and then I do migrate, it automatically makes the s3 backup setting doctype to orphaned doctype and removes it also, without s3 backup setting doctype it doesn’t allow me to do CLI commands

I also facing the Same issue

S3 backup backup which is part of frappe framework is not related to S3 File Attachments.

  1. Report the issues to app developer
  2. Or fix the issues and contribute.