一个上传文件的接口都搞不定? 坑 #5406

Closed
opened 2026-02-21 18:10:50 -05:00 by yindo · 2 comments
Owner

Originally created by @Alixxxxxxx on GitHub (Sep 5, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1

Cloud or Self Hosted

Cloud

Steps to reproduce

1

✔️ Expected Behavior

1

Actual Behavior

1

Originally created by @Alixxxxxxx on GitHub (Sep 5, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 1 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1 ### ✔️ Expected Behavior 1 ### ❌ Actual Behavior 1
yindo closed this issue 2026-02-21 18:10:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 5, 2024):

I found some similar discussions and issues that might help you resolve the file upload problem:

  1. Discussions:

  2. Closed Issues:

For your specific issue with the file upload interface in Dify version 1 on the cloud, ensure the following:

  1. File Size and Quantity Limits:

    • Maximum size for a single document upload is 15MB.
    • Limit of 100 total documents.
    • These limits can be adjusted for local deployments [6].
  2. Rate Limit:

    • Ensure the rate limit for the Embedding model API key has not been reached [6].
  3. API Request Format:

    • Ensure your API requests for file uploads are correctly formatted. Here is an example:
curl --location --request POST 'https://api.dify.com/datasets/{dataset_id}/document/create_by_file' \
--header 'Authorization: Bearer {api_key}' \
--form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
--form 'file=@"/path/to/file"'

Ensure the Authorization header contains your API key and the file path is correct [7].

If you need further assistance, please provide more details about the error messages or issues you are encountering.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 5, 2024): <!-- Answer --> I found some similar discussions and issues that might help you resolve the file upload problem: 1. **Discussions:** - [I can't upload the image on dify workflow via api](https://github.com/langgenius/dify/discussions/7482) (Unsolved) <sup>[[1]](https://github.com/langgenius/dify/discussions/7482)</sup> - [Upload files and return files in the conversation](https://github.com/langgenius/dify/discussions/6781) (Unsolved) <sup>[[2]](https://github.com/langgenius/dify/discussions/6781)</sup> 2. **Closed Issues:** - [Package not found err while uploading files into database](https://github.com/langgenius/dify/issues/7394) (Closed) <sup>[[3]](https://github.com/langgenius/dify/issues/7394)</sup> - **Solution:** Ensure the temporary files are not deleted prematurely during the index phase by adjusting the scope of `tempfile` in `extract_processor.py`. - [本地docker部署,数据集创建上传pdf文件失败](https://github.com/langgenius/dify/issues/1405) (Closed) <sup>[[4]](https://github.com/langgenius/dify/issues/1405)</sup> - **Solution:** Adjust the `client_max_body_size` in NGINX to handle larger file uploads. - [upload file velocity](https://github.com/langgenius/dify/issues/318) (Closed) <sup>[[5]](https://github.com/langgenius/dify/issues/318)</sup> - **Solution:** This feature has been addressed in the latest version. Ensure you are using the latest CE images. For your specific issue with the file upload interface in Dify version 1 on the cloud, ensure the following: 1. **File Size and Quantity Limits:** - Maximum size for a single document upload is 15MB. - Limit of 100 total documents. - These limits can be adjusted for local deployments <sup>[[6]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md)</sup>. 2. **Rate Limit:** - Ensure the rate limit for the Embedding model API key has not been reached <sup>[[6]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md)</sup>. 3. **API Request Format:** - Ensure your API requests for file uploads are correctly formatted. Here is an example: ```bash curl --location --request POST 'https://api.dify.com/datasets/{dataset_id}/document/create_by_file' \ --header 'Authorization: Bearer {api_key}' \ --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \ --form 'file=@"/path/to/file"' ``` Ensure the `Authorization` header contains your API key and the file path is correct <sup>[[7]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/maintain-dataset-via-api.md)</sup>. If you need further assistance, please provide more details about the error messages or issues you are encountering. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 5, 2024):

Please be friendly and follow our language policy and Code of conduct。 #1542

@crazywoola commented on GitHub (Sep 5, 2024): Please be friendly and follow our language policy and Code of conduct。 #1542
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5406