File Post
Last updated
Last updated
Prior to creating a file post, it is crucial to upload the files that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires uploading the file first, to obtain the file data that will be used in creating the file post. To upload a file, please refer to
Upon successful completion of the file upload process, you can include the file data as a parameter when creating a file post, as demonstrated in the code sample below.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
files
: Which represents an array of files uploaded by the user on Android, iOS and Flutter and fileIds
for Typescript and Javascript to include in the new post. You can pass up to 10 files in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts (Except Flutter).
metaData
- Additional properties to support custom fields.
We can build the post first by using AmityFilePostBuilder
. Then use the createFilePost
method in AmityPostRepository
to create a file post.
A post can have a maximum of ten files.