dify icon indicating copy to clipboard operation
dify copied to clipboard

The list of input field files cannot be uploaded via url connection

Open huabingli opened this issue 9 months ago • 1 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, 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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

You added the file list option in the start input field, and you won't be able to paste the file connection at runtime, resulting in a pydantic validation error.

Image

Image

{
    "code": "invalid_param",
    "message": "1 validation error for File\n  Value error, Invalid file url [type=value_error, input_value={'id': None, 'tenant_id':...e/png', 'size': 1364573}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.9/v/value_error",
    "status": 400
}

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

huabingli avatar Mar 14 '25 09:03 huabingli

I found a similar unsolved discussion regarding issues with uploading images via URL in the Dify workflow [1].

For your specific issue, ensure that the file URLs you are using are valid external URLs. The URL should start with "http" or "ftp" as per the validation rules in the Dify codebase. If the URL is not in this format, it will result in a Pydantic validation error [2].

Make sure your JSON payload for the file URL follows this format:

{
  "inputs": {
    "url": {
      "type": "document",
      "transfer_method": "remote_url",
      "url": "https://your-actual-remote-url.com/file.png"
    }
  }
}

If you are using a local file, ensure the transfer_method is set to local_file and provide the upload_file_id instead of a URL [3].

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] avatar Mar 14 '25 09:03 dosubot[bot]

I also encountered this problem, and I have now identified the root cause: After a thorough investigation, I found that the issue does not occur in Dify Cloud Service version 1.1.3. Further checking the browser console, I discovered that after a file is uploaded successfully, the URL parameter returned by the Dify interface includes an http://ip:port prefix, which is absent in my locally deployed Dify. By tracing the source code of Dify, I found that Dify concatenates this prefix by reading the dify_config.FILES_URL configuration from the docker/.env.example file. I performed a global search for FILES_URL and found that this configuration item is empty by default in the docker/.env file. Therefore, I modified it to my Dify access address: http://192.168.10.14/ (if your Dify is not using port 80, please remember to add ':port number' after the IP). I hope these steps can be helpful to you!

If the same issue persists after making the modifications, here are three friendly suggestions for you to consider:

  1. Avoid using localhost; it's recommended to use the actual intranet IP address instead.
  2. If you are using proxy software, remember to turn it off before testing.
  3. After making the changes, run docker-compose down && docker-compose up -d to ensure the updates take effect.

During my use of Dify, I encountered other frequently occurring issues that were not clearly explained in the official documentation. You can check and bookmark this link for reference: Essential for Dify Development: Sharing 8 Key Techniques Not Explained in the Official Documentation

jiabaogithub avatar Apr 03 '25 03:04 jiabaogithub

Hi, @huabingli. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You reported a bug in Dify version 1.0.1 related to file uploads via URL causing pydantic validation errors.
  • I suggested ensuring URLs are valid external URLs and provided a JSON payload format.
  • Jiabaogithub identified the root cause as the FILES_URL configuration in Docker setup and suggested modifications.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If no updates are provided, the issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar May 04 '25 16:05 dosubot[bot]

It works for me in v1.3.1

laipz8200 avatar May 06 '25 09:05 laipz8200