# Attachment

Attachment

This set of APIs allows app to upload and manage attachment associated with a post. It allows user to attach and remove multiple attachments regardless of file type (although mobile app has limited file type support such as images only in iPhone).

# new_topic, reply_post

Function:

Function Name Description Level
new_topic reply_post Add the following parameter to the existing function:

Input Parameters:

Name Type Required? Description Level
group_id String group ID of group of attachment associated with this post. Leave this empty if the forum system does not require group_id

Output Parameters:

Name Type Required? Description Level

# get_topic

Function:

Function Name Description Level
get_topic Add the following key-value pairs to the existing function:

Input Parameters:

Name Type Required? Description Level

Output Parameters:

Name Type Required? Description Level
can_upload Boolean return true if the user has authority to upload attachments in this sub-forum.

# get_thread

Function:

Function Name Description Level
get_thread Add the following key-value pairs to the existing function

Input Parameters:

Name Type Required? Description Level

Output Parameters:

Name Type Required? Description Level
can_upload Boolean return true if the user has authority to upload attachments in this thread.

# upload.php

Function:

Function Name Description Level
upload.php This function allows the app to pass the actual file content to the forum system. It allows user either to upload attachments to a post ("method_name=upload_attach"), or to update his own profile picture ("method_name=upload_avatar"). For profile picture upload, it is used in conjunction with "can_upload_avatar" in "login" function to indicate users has the permission to change his own profile picture.

Input Parameters:

Name Type Required? Description Level
method_name byte[] yes For attachmet upload, set this as "upload_attach". For avatar upload (profile picture upload), set this as "upload_avatar".
forum_id String For "method_name=upload_attach" only. Forum ID, needed when upload attachment to post
message_id String For "method_name=upload_attach" only. Conversation/PM ID, needed when upload attachment to Conversation/PM
group_id String For "method_name=upload_attach" only. This ID is used to group attachments and associate them to a single post. Useful for multiple attachments upload support. The group_id can be obtained from the result of this function. The app can pass NULL value to this field if it is the first attachment for the post.
type String Post type, where the attachment was uploaded to. Current valid value is 'post' or 'pm'. Default is 'post. When this parameter was set to 'pm', no need forum_id parameter then.
content byte[] yes This is the multi-part upload file name.

Output Parameters:

Name Type Required? Description Level
result Boolean yes Return "true" if the action is executed successfully. "false" otherwise.
result_text byte[] Message to be displayed to user after this action is executed. Optional.
attachment_id String yes This ID is needed by the app to pass into the new_topic or reply_post functions to finalize the attachments linkage with the post.
group_id String This ID is needed by the forum system to associate attachments with a specific post. Do not return this field if a forum system does not require group_id for attachment assication. This group_id can also be dynamic depends on the forum system.
filters_size Int Return the file size of the uploaded file after processed by the forum system.

# remove_attachment

Function:

Function Name Description Level
remove_attachment This function instructs the forum system to remove the attachment from the post.

Input Parameters:

Name Type Required? Description Level
attachment_id String yes
forum_id String yes Set 0 from conversation
group_id String yes
message_id String yes This field is required for editing existing post/message that contains attachments.

Output Parameters:

Name Type Required? Description Level
result Boolean yes Return "true" if the action is executed successfully. "false" otherwise.
result_text byte[] Message to be displayed to user after this action is executed. Optional.
group_id String Depends on different forum system, the group ID can be dynamic. If this key is returned, the app will change the group_id for the current message attachment session.