Dify File icon

Dify File

Upload and manage files in Dify AI platform for use in conversations and workflows

Actions3

File → Upload

AI-generated

Overview

The node enables uploading and managing files on the Dify AI platform, which can be used in conversations and workflows. Specifically, the File Upload operation allows users to upload various types of files (audio, document, image, video) by providing binary file data along with optional metadata such as user identification and upload constraints.

This node is beneficial when automating workflows that require storing or processing files within the Dify AI ecosystem, for example:

  • Uploading user-generated content like images or documents for AI analysis.
  • Automating media ingestion pipelines where audio or video files are uploaded for transcription or processing.
  • Managing document uploads linked to specific users for tracking or auditing purposes.

Properties

Name Meaning
File The name of the binary property containing the file data to upload. Default is "data". This tells the node where to find the actual file content in the input data.
User Identifier string representing the user who uploads the file. Useful for tracking or associating files with specific users. Example: "user123".
Options Collection of optional settings to control the upload behavior:
- File Type Type of the file being uploaded. Options include: Audio, Auto Detect (default), Document, Image, Video. Auto Detect lets the system infer type from extension/content.
- Max File Size Maximum allowed file size in megabytes. Defaults to 15 MB. Limits uploads to prevent excessively large files.
- Allowed Extensions Comma-separated list of allowed file extensions (e.g., "pdf,docx,txt"). Leave empty to allow all supported extensions.

Output

The node outputs an array of JSON objects corresponding to each input item processed. For the Upload operation, the output JSON typically contains metadata about the uploaded file such as its identifier, URL, type, size, and any other relevant information returned by the Dify API.

If the node supports returning binary data (not explicitly shown for upload), it would include the file content in binary form under a binary property.

Dependencies

  • Requires an API key credential for authenticating with the Dify AI platform.
  • Needs the base URL of the Dify API configured in credentials.
  • Relies on the Dify AI platform's file management API endpoints to perform uploads.

Troubleshooting

  • Common issues:

    • Upload failures due to exceeding the maximum file size limit.
    • Unsupported file extensions if the allowed extensions list is restrictive.
    • Authentication errors if the API key or base URL is misconfigured.
    • Network timeouts if the file upload takes longer than the specified timeout.
  • Error messages:

    • "The operation "upload" is not supported for resource "file": Indicates an invalid operation was selected; ensure "upload" is chosen.
    • "The resource "..." is not supported": Means the resource parameter is incorrect; must be "file" for this operation.
    • Errors related to file size or type will usually come from the API response and should be handled by adjusting options accordingly.

Links and References

Discussion