Skip to main content

1. Use Cases

Use the Attachment component to upload file content such as certificates, materials, data, and contracts. Each attachment in YiDA is currently limited to 100 MB.
For component attributes, usage, and examples, see Interface.

2. Basic Features

2.1 Upload Type

Feature: Set how attachments are uploaded. Path: Attribute >> Upload detail settings >> Upload type Two upload types are available: click and drag-and-drop. Click (when set to click, click Upload File to upload attachments directly) Drag-and-drop (when set to drag-and-drop, drag files into the dashed box to upload):

2.2 Button Content

Feature: Set the text of the upload button. Path: Attribute >> Upload detail settings >> Button content (this option appears only when the upload type is set to click) The effect is as follows: The button content defaults to Upload File. You can customize the button text to fit your needs. The effect is as follows:

2.3 Button Type

Three button types are available: primary, second (secondary), and normal. primary: the button has a blue background with white text. The effect is as follows: second (secondary): the button has a blue border and blue text. The effect is as follows: normal: the button has a gray border and gray text. The effect is as follows:

2.4 Multiselect and Maximum Number of Files

2.4.1 Multiselect

Feature: When Multiselect is on, users can upload multiple attachments at once. Path: Attribute >> Upload detail settings >> Multiselect Note: With Multiselect on, users can select multiple files when uploading. The number of files they can select depends on the value set in “Maximum number of files.”

2.4.2 Maximum Number of Files

Feature: Set the maximum number of attachments that can be uploaded. Path: Attribute >> Upload detail settings >> Maximum number of files When the maximum number of files is set to 4, the effect is as follows:

2.5 Upload File Type

Feature: Set the file formats allowed for upload.
File extensions support only digits and English letters.
Path: Attribute >> Upload detail settings >> Upload file type Example: If the upload file type is set to PDF, only PDF files can be uploaded. The effect is as follows: After this setting, other file types cannot be uploaded on the upload page. As shown below, files in other image formats are grayed out and cannot be selected. Only PDF files can be selected and uploaded. This property sets the accept attribute for file uploads, which restricts allowed file types. For details, see the MDN documentation.

2.6 Online Attachment Preview

Previewing before submission lets you verify that the uploaded attachments are correct. Previewing after submission reduces the need to download attachments and saves local storage. Online attachment preview is now supported on both PC and mobile, before and after data submission. Preview supports three types of Office documents—Excel, Word, and PPT—as well as PDF. Supported extensions: Excel: et, xls, xlt, xlsx, xlsm, xltx, xltm, csv Word: doc, docx, txt, dot, wps, wpt, dotx, docm, dotm PPT: ppt, pptx, pptm, pptm, ppsm, pps, potx, potm, dpt, dps Online preview on PC Online preview on mobile

2.7 Upload Attachments in Comments

When commenting on submitted form data, you can upload attachments on both PC and mobile. Upload attachments in comments on PC Upload attachments in comments on mobile

3. Online Attachment Editing

3.1 Prerequisites

Note: This feature is exclusive to the Professional edition and above.
  1. Attachment editing currently supports three types of Office documents: Word, PPT, and Excel. Supported extensions:
Excel: et, xls, xlt, xlsx, xlsm, xltx, xltm, csv Word: doc, docx, txt, dot, wps, wpt, dotx, docm, dotm PPT: ppt, pptx, pptm, pptm, ppsm, pps, potx, potm, dpt, dps Note: In addition to the types above, attachment preview also supports PDF.

3.2 How to Enable

To use online attachment editing, first turn on the “Online editing” switch on the Attachment component. Turning on this switch only means the form supports online editing. To edit uploaded attachments after data submission, you also need to configure permissions. Note: Permission configuration differs between forms and workflow forms. Refer to the following paths: Path: Open the target form >> Settings >> Page permissions >> Add permission group >> Select the editable permission in the Attachment column Path: Open the target workflow form >> Settings >> Workflow design >> Set up the approval node >> Configure the action permissions of the approver at the current approval node >> Select “Editable” in the Attachment column (approvers with this permission can edit attachments online during approval) After configuration, open the form details to edit attachments online. The effect is as follows: Click the “Edit” button to open a new editing page.

3.3 How Online Editing Works

3.3.1 Auto-Save

The editing page saves automatically after each edit. You can also press “Ctrl+S” to save manually. Frequent saving is not recommended. Each manual save creates a new version, and the system limits saved versions to 10.

3.3.2 Collaboration Records

Click “Collaboration records” in the upper-right corner to view the edit history of every user who has worked on the document. Note: The “Version history” feature on this page is not yet available. The effect is as follows:

4. Advanced Validation

Example scenario: Require users to upload exactly 2 attachments—no more, no fewer. Path: Turn on Multiselect >> Set the maximum number of files to 2 >> Click Validation >> Custom function. Copy the following code into the custom function page. The effect is as follows: Copy and reuse the following code (adjust the number as needed, but keep it in sync with the maximum number of files):
The result looks like this:

5. FAQ

To set a minimum number of attachments, configure a custom validation function on the Attachment component.Path: Click the Attachment component >> Attribute panel >> Custom validation functionCopy and reuse the following code:
Exporting attachments and images is supported. Download the files from the data management page.
Images uploaded through the Attachment component cannot be rotated. If you need rotation, use the Image Upload component to submit image data.
Create an OnChange action on the Attachment component. The preview URL does not include a domain, so when assigning it to a Single-line text component, prepend “https://www.yidaapps.com” as shown below:Code example:

5.5 Attachment Preview Error: Server Error, Try Again!

If the error “Server error, try again!” appears when previewing an attachment on the Source records page, check whether the DingTalk UserID of the user performing the preview contains an underscore ”_”. UserID supports only uppercase and lowercase letters, digits 0-9, and hyphens (-). Path to set UserID: Admin signs in to the DingTalk Admin Console >> [Contacts] in the left panel >> [Internal Contacts Management] >> [Add User] >> Set [Employee UserID]. Tips:
  • UserID is the unique identifier of an employee in the organization. Once generated, it cannot be changed.
  • After leaving and rejoining the organization, previous records—such as attendance, reports, approvals, and YiDA form data—can no longer be viewed. Proceed with caution.

5.6 Conditions for Attachment Preview

  • Attachment preview has file size limits: 20 MB for the Free plan and Basic edition, and 60 MB or more for the Professional and Dedicated editions. Larger files must be downloaded to your device before previewing.