upload file failed #6830

Closed
opened 2026-02-21 18:17:30 -05:00 by yindo · 14 comments
Owner

Originally created by @ljwps on GitHub (Nov 19, 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

0.11.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Upgrade from 0.6.x to 0.11.1

Upgrade Process:

  1. The local version was originally 0.6.x from Git.
  2. Switched to the 0.11.1 tag.
  3. Ran docker-compose down.
  4. Ran docker-compose pull.
  5. Ran docker-compose up -d.

After starting up, I created a node with a file upload feature for testing. When trying to upload a .docx file in the preview mode, an error appeared saying "File type not supported." I also tried uploading an .xlsx file and encountered the same error. However, uploading an .xml file was successful.

Using the browser's F12 developer tools to inspect the file upload request, I noticed that no request was actually sent. This suggests that the file type check is performed on the client side, as there are no error logs on the server.

Screenshots
image

image

image

image

image

✔️ Expected Behavior

upload file success

Actual Behavior

File type not supported

Originally created by @ljwps on GitHub (Nov 19, 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 0.11.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce **Upgrade from 0.6.x to 0.11.1** **Upgrade Process:** 1. The local version was originally 0.6.x from Git. 2. Switched to the 0.11.1 tag. 3. Ran docker-compose down. 4. Ran docker-compose pull. 5. Ran docker-compose up -d. After starting up, I created a node with a file upload feature for testing. When trying to upload a .docx file in the preview mode, an error appeared saying "File type not supported." I also tried uploading an .xlsx file and encountered the same error. However, uploading an .xml file was successful. Using the browser's F12 developer tools to inspect the file upload request, I noticed that no request was actually sent. This suggests that the file type check is performed on the client side, as there are no error logs on the server. **Screenshots** ![image](https://github.com/user-attachments/assets/c698b0f4-aa43-4991-86ee-1f2c3df3b27e) ![image](https://github.com/user-attachments/assets/c07bb96d-333f-4f98-9fa5-54726eea95d0) ![image](https://github.com/user-attachments/assets/ece5028d-4e06-4464-aa88-dd4b6adecdbc) ![image](https://github.com/user-attachments/assets/9be22f98-c085-4fba-acfe-bfc56c6f0bd3) ![image](https://github.com/user-attachments/assets/6612e6a5-7652-4329-a510-3480a3fb30c2) ### ✔️ Expected Behavior upload file success ### ❌ Actual Behavior File type not supported
yindo added the 🐞 bug label 2026-02-21 18:17:30 -05:00
yindo closed this issue 2026-02-21 18:17:30 -05:00
Author
Owner

@ljwps commented on GitHub (Nov 19, 2024):

Today, upgraded to version 0.11.2 following the same process, but the issue persists.

@ljwps commented on GitHub (Nov 19, 2024): Today, upgraded to version 0.11.2 following the same process, but the issue persists.
Author
Owner

@dosubot[bot] commented on GitHub (Nov 19, 2024):

There are a few similar issues and discussions related to file upload problems in Dify:

  1. An open issue titled "Invalid upload file" error in test chat history if there was file uploaded suggests ensuring that workflows are manually migrated to align with changes in file upload functionality introduced in recent versions. It also recommends verifying file upload constraints and environment variable settings [1].

  2. Another open issue, When uploading a file locally, a .docx file saved by WPS was selected. The frontend reports Unsupported file type, suggests modifying the getFileExtension method to handle cases where the MIME type might not be correctly identified [2].

  3. A closed issue, upload file failed, recommends ensuring that the upload_file_id is correctly set and verifying client-side validation scripts for file types [3].

For your specific issue, ensure that the client-side validation checks are correctly configured. The isAllowedFileExtension function in the Dify codebase checks if a file's extension is allowed by comparing it against a list of supported file extensions. This function is located in the web/app/components/base/file-uploader/utils.ts file [4].

Additionally, verify that the dify_config settings are correctly set, especially the ETL_TYPE and UNSTRUCTURED_API_URL, as they affect the recognized document extensions [5][6]. If the problem persists, further investigation into the application setup or potential bugs in the version may be necessary.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 19, 2024): <!-- Answer --> There are a few similar issues and discussions related to file upload problems in Dify: 1. An open issue titled ["Invalid upload file" error in test chat history if there was file uploaded](https://github.com/langgenius/dify/issues/10376) suggests ensuring that workflows are manually migrated to align with changes in file upload functionality introduced in recent versions. It also recommends verifying file upload constraints and environment variable settings <sup>[[1]](https://github.com/langgenius/dify/issues/10376)</sup>. 2. Another open issue, [When uploading a file locally, a .docx file saved by WPS was selected. The frontend reports Unsupported file type](https://github.com/langgenius/dify/issues/9992), suggests modifying the `getFileExtension` method to handle cases where the MIME type might not be correctly identified <sup>[[2]](https://github.com/langgenius/dify/issues/9992)</sup>. 3. A closed issue, [upload file failed](https://github.com/langgenius/dify/issues/10597), recommends ensuring that the `upload_file_id` is correctly set and verifying client-side validation scripts for file types <sup>[[3]](https://github.com/langgenius/dify/issues/10597)</sup>. For your specific issue, ensure that the client-side validation checks are correctly configured. The `isAllowedFileExtension` function in the Dify codebase checks if a file's extension is allowed by comparing it against a list of supported file extensions. This function is located in the `web/app/components/base/file-uploader/utils.ts` file <sup>[[4]](https://github.com/langgenius/dify/blob/main/web/app/components/base/file-uploader/utils.ts)</sup>. Additionally, verify that the `dify_config` settings are correctly set, especially the `ETL_TYPE` and `UNSTRUCTURED_API_URL`, as they affect the recognized document extensions <sup>[[5]](https://github.com/langgenius/dify/blob/main/api/constants/__init__.py)</sup><sup>[[6]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. If the problem persists, further investigation into the application setup or potential bugs in the version may be necessary. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@ljwps commented on GitHub (Nov 19, 2024):

I also performed a fresh deployment of the latest version, and the file upload issue persists.

@ljwps commented on GitHub (Nov 19, 2024): I also performed a fresh deployment of the latest version, and the file upload issue persists.
Author
Owner

@sigvardt commented on GitHub (Nov 19, 2024):

Experiencing the same here.

@sigvardt commented on GitHub (Nov 19, 2024): Experiencing the same here.
Author
Owner

@hanqingwu commented on GitHub (Nov 21, 2024):

yes, it persists at 0.11.2 . I think root cause in web frontend . because i don't catch web send request api.

@hanqingwu commented on GitHub (Nov 21, 2024): yes, it persists at 0.11.2 . I think root cause in web frontend . because i don't catch web send request api.
Author
Owner

@sigvardt commented on GitHub (Nov 22, 2024):

Also experincing it when I use the workflow API.

@sigvardt commented on GitHub (Nov 22, 2024): Also experincing it when I use the workflow API.
Author
Owner

@crazywoola commented on GitHub (Nov 24, 2024):

Can you provide an example doc here. I can not reproduce this problem with this file type.

@crazywoola commented on GitHub (Nov 24, 2024): Can you provide an example doc here. I can not reproduce this problem with this file type.
Author
Owner

@sigvardt commented on GitHub (Nov 25, 2024):

@crazywoola more details here in a similar issue I opened:

https://github.com/langgenius/dify/issues/10557

@sigvardt commented on GitHub (Nov 25, 2024): @crazywoola more details here in a similar issue I opened: https://github.com/langgenius/dify/issues/10557
Author
Owner

@perzeuss commented on GitHub (Nov 25, 2024):

@crazywoola I am able to reproduce it. The file upload works, but as soon as you run the chatflow with the uploaded file in the request (upload_file_id), you get a 400 response.
In was able to reproduce it on both console api (https://cloud.dify.ai/console/api/apps/.../advanced-chat/workflows/draft/run) and webapp api (https://udify.app/api/chat-messages)

{"code": "invalid_param", "message": "Invalid upload file", "status": 400}

Example file: Random Reviews.xlsx

Screenshot: image

Example workflow:

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: XLSX Document Chatflow
  use_icon_as_answer_icon: false
kind: app
version: 0.1.3
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: answer
      id: 1732553887444-source-answer-target
      source: '1732553887444'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: Start
        type: start
        variables:
        - allowed_file_extensions: []
          allowed_file_types:
          - document
          allowed_file_upload_methods:
          - local_file
          - remote_url
          label: document
          max_length: 48
          options: []
          required: true
          type: file
          variable: document
      height: 90
      id: '1732553887444'
      position:
        x: 30
        y: 250
      positionAbsolute:
        x: 30
        y: 250
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        answer: Just testing the upload
        desc: ''
        selected: false
        title: Answer
        type: answer
        variables: []
      height: 100
      id: answer
      position:
        x: 334
        y: 250
      positionAbsolute:
        x: 334
        y: 250
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: 341
      y: 35
      zoom: 0.7
@perzeuss commented on GitHub (Nov 25, 2024): @crazywoola I am able to reproduce it. The file upload works, but as soon as you run the chatflow with the uploaded file in the request (upload_file_id), you get a 400 response. In was able to reproduce it on both console api (https://cloud.dify.ai/console/api/apps/.../advanced-chat/workflows/draft/run) and webapp api (https://udify.app/api/chat-messages) ```json {"code": "invalid_param", "message": "Invalid upload file", "status": 400} ``` Example file: [Random Reviews.xlsx](https://github.com/user-attachments/files/17906694/Random.Reviews.xlsx) Screenshot: ![image](https://github.com/user-attachments/assets/409678b5-45d8-45b0-bd7a-b473911bb113) Example workflow: ```yaml app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: XLSX Document Chatflow use_icon_as_answer_icon: false kind: app version: 0.1.3 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG allowed_file_types: - image allowed_file_upload_methods: - local_file - remote_url enabled: false fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false sourceType: start targetType: answer id: 1732553887444-source-answer-target source: '1732553887444' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: false title: Start type: start variables: - allowed_file_extensions: [] allowed_file_types: - document allowed_file_upload_methods: - local_file - remote_url label: document max_length: 48 options: [] required: true type: file variable: document height: 90 id: '1732553887444' position: x: 30 y: 250 positionAbsolute: x: 30 y: 250 selected: true sourcePosition: right targetPosition: left type: custom width: 244 - data: answer: Just testing the upload desc: '' selected: false title: Answer type: answer variables: [] height: 100 id: answer position: x: 334 y: 250 positionAbsolute: x: 334 y: 250 selected: false sourcePosition: right targetPosition: left type: custom width: 244 viewport: x: 341 y: 35 zoom: 0.7 ```
Author
Owner

@zolgear commented on GitHub (Nov 25, 2024):

After upgrading to 0.12.0, the error "Invalid upload file," as reported by @perzeuss, occurred.

  • The upload is successful, and files are correctly generated under app/storage/upload_files/....

Since the upload succeeds and the issue began with 0.12.0, it appears to be unrelated to the original issue.

The affected file types are audio files (mp3, m4a, wav).
Document file types and the DOC EXTRACTOR node work correctly.

@zolgear commented on GitHub (Nov 25, 2024): After upgrading to 0.12.0, the error "Invalid upload file," as reported by @perzeuss, occurred. - The upload is successful, and files are correctly generated under `app/storage/upload_files/...`. Since the upload succeeds and the issue began with 0.12.0, it appears to be unrelated to the original issue. The affected file types are audio files (mp3, m4a, wav). Document file types and the DOC EXTRACTOR node work correctly.
Author
Owner

@crazywoola commented on GitHub (Nov 26, 2024):

We have several fixes related to #11112 #11111 #11114 @zolgear @perzeuss Please wait for the 0.12.1

@crazywoola commented on GitHub (Nov 26, 2024): We have several fixes related to #11112 #11111 #11114 @zolgear @perzeuss Please wait for the 0.12.1
Author
Owner

@sigvardt commented on GitHub (Nov 26, 2024):

@crazywoola just tested with managed version of 0.12.1 and issue is still present.

@sigvardt commented on GitHub (Nov 26, 2024): @crazywoola just tested with managed version of 0.12.1 and issue is still present.
Author
Owner

@lzcmagic commented on GitHub (Nov 26, 2024):

We have several fixes related to #11112 #11111 #11114 @zolgear @perzeuss Please wait for the 0.12.1

This version does not report 'upload file failed', and the file variable is also not functioning properly。

@lzcmagic commented on GitHub (Nov 26, 2024): > We have several fixes related to #11112 #11111 #11114 @zolgear @perzeuss Please wait for the 0.12.1 This version does not report 'upload file failed', and the file variable is also not functioning properly。
Author
Owner

@ChungRae commented on GitHub (Dec 12, 2024):

The parameter passed by the front end is wrong and is always the default option
微信图片_20241212145557
微信图片_2024-12-12_145730_439

@ChungRae commented on GitHub (Dec 12, 2024): The parameter passed by the front end is wrong and is always the default option ![微信图片_20241212145557](https://github.com/user-attachments/assets/e323886b-b15a-4881-b3ff-c05b47613642) ![微信图片_2024-12-12_145730_439](https://github.com/user-attachments/assets/6a9b2259-f1f1-4b0a-9afe-e97c14635c49)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6830