Uploading files in the http_request node, but the actual request cannot pass the files. #8650

Closed
opened 2026-02-21 18:26:51 -05:00 by yindo · 3 comments
Owner

Originally created by @JayHsu5 on GitHub (Feb 26, 2025).

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.15.3

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image
logs info
--------------------header {'accept': 'application/json', 'Content-Type': 'multipart/form-data'}
------------------------request_args {'url': 'http://127.0.0.1:9001/autotrain/test_read_file', 'data': {}, 'files': None, 'json': None, 'content': None, 'headers': {'accept': 'application/json', 'Content-Type': 'multipart/form-data'}, 'params': [], 'timeout': (300, 600, 600), 'follow_redirects': True, 'max_retries': 0}
2025-02-26 09:22:05,523 INFO [_client.py:1038] e759646cda HTTP Request: POST http://127.0.0.1:9001/autotrain/test_read_file "HTTP/1.1 400 Bad Request"

✔️ Expected Behavior

Correctly handle files

Actual Behavior

error

Originally created by @JayHsu5 on GitHub (Feb 26, 2025). ### 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.15.3 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/89337b3d-0c7c-4bdd-a9c9-2f2525beb64b) **logs info** --------------------header {'accept': 'application/json', 'Content-Type': 'multipart/form-data'} ------------------------request_args {'url': 'http://127.0.0.1:9001/autotrain/test_read_file', 'data': {}, 'files': None, 'json': None, 'content': None, 'headers': {'accept': 'application/json', 'Content-Type': 'multipart/form-data'}, 'params': [], 'timeout': (300, 600, 600), 'follow_redirects': True, 'max_retries': 0} 2025-02-26 09:22:05,523 INFO [_client.py:1038] e759646cda HTTP Request: POST http://127.0.0.1:9001/autotrain/test_read_file "HTTP/1.1 400 Bad Request" ### ✔️ Expected Behavior Correctly handle files ### ❌ Actual Behavior error
yindo closed this issue 2026-02-21 18:26:51 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 26, 2025):

To handle file uploads in the HTTP request node and avoid the "400 Bad Request" error, you should note that Dify's HTTP request node does not support single file uploads directly. Instead, you need to use either an iteration node or a code node to handle the file upload. This is necessary because the current file selection interface only allows Array[File] selection, while the '/v1/files/upload' endpoint requires a single File input. Ensure that your configuration includes the POST method, an Authorization header with a Bearer token, and the Content-Type set to multipart/form-data, with form data fields for the file (type: file) and user (type: text) [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Feb 26, 2025): <!-- Answer --> To handle file uploads in the HTTP request node and avoid the "400 Bad Request" error, you should note that Dify's HTTP request node does not support single file uploads directly. Instead, you need to use either an iteration node or a code node to handle the file upload. This is necessary because the current file selection interface only allows Array[File] selection, while the '/v1/files/upload' endpoint requires a single File input. Ensure that your configuration includes the POST method, an Authorization header with a Bearer token, and the Content-Type set to multipart/form-data, with form data fields for the file (type: file) and user (type: text) <sup>[[1]](https://github.com/langgenius/dify/issues/13634)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/52c5d280-eac1-4ef7-a66e-3410198a77ca?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 26, 2025):

The type is mismatch.

Image
@crazywoola commented on GitHub (Feb 26, 2025): The type is mismatch. <img width="227" alt="Image" src="https://github.com/user-attachments/assets/a159c3e5-f8b2-4b6b-9aa3-b62a01424455" />
Author
Owner

@hczs commented on GitHub (Mar 13, 2025):

The type is mismatch.

Image

How to send the type of "Array[File]" param use HTTP ?

@hczs commented on GitHub (Mar 13, 2025): > The type is mismatch. > > <img alt="Image" width="227" src="https://private-user-images.githubusercontent.com/100913391/417079138-a159c3e5-f8b2-4b6b-9aa3-b62a01424455.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDE4NTk3MzcsIm5iZiI6MTc0MTg1OTQzNywicGF0aCI6Ii8xMDA5MTMzOTEvNDE3MDc5MTM4LWExNTljM2U1LWY4YjItNGI2Yi05YWEzLWI2MmEwMTQyNDQ1NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMzEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDMxM1QwOTUwMzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNjBiMzI1ZWRlYTM4M2M1ZmFlZGU1YTVmODA2YmUyYTA1NDI2OTBiZjAzMjIxZDY5YWQ3ZjI2YmFlZTAxYzY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.TZxuudE6DKhyHHoQFU2eQX56hDJ7TTu968IddJeT69o"> How to send the type of "Array[File]" param use HTTP ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8650