- HTTPS URL: We’ll download the attachment from the provided URL. This is the easiest method, but requires you to serve your files over the internet.
-
Media Library URI: Use this feature when you need to upload files directly using the
media_library://
protocol.
Using the Media Library
First, create a signed upload URL with the path to your file:test.png
.
You can also upload to nested paths, for example /storage/upload/sign/media_library/my-dir/test.png
. This will create an upload URL for my-dir/test.png
.
Next, upload your file using the signed URL:
attachments: ["media_library://test.png"]
attachments: ["media_library://my-dir/test.png"]