Open muckthaa-ss opened 2 hours ago
I found some relevant discussions and issues regarding file uploads in the HTTP request block in Dify:
To resolve your issue, make sure your HTTP request is formatted to handle multipart form-data. You can refer to the example provided in the closed issue for guidance on structuring your request.
To continue talking to Dosu, mention @dosu.
sample workflow for file upload in http request
To set up a file upload in an HTTP request block within a Dify workflow, you can use the following cURL example as a guide:
curl --location --request POST '${props.apiBaseUrl}/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"'
This example demonstrates how to use a multipart/form-data request to upload a file along with additional data parameters. You need to replace '/path/to/file'
with the actual path to your file and fill in the placeholders like ${props.apiBaseUrl}
, {dataset_id}
, and {api_key}
with your specific values [1].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.6.15
Cloud or Self Hosted
Cloud
Steps to reproduce
To upload file in the http request block in workflow
✔️ Expected Behavior
Upload option in http request block
❌ Actual Behavior
i cant upload any file in the http block