dify icon indicating copy to clipboard operation
dify copied to clipboard

升级0.65版本后,上传文件会出现失败。

Open koulas opened this issue 1 year ago • 1 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.65

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

自部署的docker版本,升级0.65版本后,超过1m文件上传会出现上传文件失败,之前5.9版本都是正常的。本机用了nginx反代端口,文件配置上也已经加上client_max_body_size的设置了。 035df09e39d87369505af5634a6a104 264821d852e4f1cf37940ed7f2be28a 页面报413错误。 本机nginx的配置 a1c2dd966fc333fd5e3d0e7a668d4d1

✔️ Expected Behavior

希望能够上传超过1m文件

❌ Actual Behavior

No response

koulas avatar May 01 '24 13:05 koulas

To address the issue of failing file uploads larger than 1MB in Dify version 0.65, despite having client_max_body_size set to 300M in Nginx, you'll need to adjust Dify's internal file upload size limits. These settings are found within Dify's configuration, specifically in the api/config.py file, and include UPLOAD_FILE_SIZE_LIMIT and UPLOAD_IMAGE_FILE_SIZE_LIMIT. By default, these may not match the limit you've set in Nginx.

Here's how to resolve the issue:

  1. Modify Dify Configuration: Open the api/config.py file in your Dify installation and change the UPLOAD_FILE_SIZE_LIMIT and UPLOAD_IMAGE_FILE_SIZE_LIMIT values to 300 (or your desired limit in megabytes).

  2. Restart Dify Application: To apply the configuration changes, restart your Dify application. If using Docker, this can be done with:

    docker-compose down
    docker-compose up -d
    
  3. Ensure Nginx Configuration Matches: Double-check that your Nginx configuration's client_max_body_size is set to 300M or your desired limit.

  4. Test the File Upload: Attempt to upload a file larger than 1MB again to confirm the issue is resolved.

Adjusting both the Nginx and Dify configurations to support larger file uploads should solve the problem. However, be aware of potential risks associated with increasing the file upload size limit, such as increased resource consumption and security risks.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 01 '24 14:05 dosubot[bot]

Close due to #1542

crazywoola avatar May 01 '24 15:05 crazywoola

已经按照给出的办法设置了,还是上传失败。

koulas avatar May 02 '24 15:05 koulas

@koulas 解决了吗?我也遇到同样问题

TimeCyber avatar May 20 '24 06:05 TimeCyber