File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
docusaurus/docs/reactnative/guides Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,48 @@ const StreamButton = () => {
183183/>
184184```
185185
186+ ## Storing image and file attachment to custom CDN
187+
188+ When you select an image or file from image picker or file picker, it gets uploaded to Stream's CDN by default.
189+ But you can choose to upload attachments to your own CDN using following two props on Channel component:
190+
191+ - [ ` doImageUploadRequest ` ] ( ../core-components/channel.mdx#doimageuploadrequest ) : For images picked from image picker
192+ - [ ` doDocUploadRequest ` ] ( ../core-components/channel.mdx#dodocuploadrequest ) : For files picked from file picker
193+
194+ ``` tsx
195+ <Channel
196+ doDocUploadRequest = { (file , channel ) =>
197+ chatClient ?.sendFile (
198+ ` ${channel ._channelURL ()}/file ` , // replace this with your own cdn url
199+ file .uri ,
200+ ' name_for_file' ,
201+ )
202+ }
203+ doImageUploadRequest = { (file , channel ) =>
204+ chatClient ?.sendFile (
205+ ` https://customcdnurl.com ` , // replace this with your own cdn url
206+ file .uri ,
207+ ' name_for_file' ,
208+ )
209+ }
210+ />
211+ ```
212+
213+ :::note
214+
215+ Usage of ` chatClient?.sendFile ` is optional in above examples. You may choose to use any HTTP client for uploading the file.
216+ But make sure to return a promise that is resolved to an object with the key ` file ` that is the url of the uploaded file.
217+
218+ For example:
219+
220+ ``` tsx
221+ {
222+ file : ' https://us-east.stream-io-cdn.com/62344/images/a4f988f5-6a9c-47b0-aab9-7a27b74d7515.60D6041A-D012-4721-B794-19267B8F352B.jpg'
223+ }
224+ ```
225+
226+ :::
227+
186228## Disabling File Uploads or Image Uploads
187229
188230There are three ways to disable file or image uploads from RN app:
You can’t perform that action at this time.
0 commit comments