Hey dify team I need know how can I access the document which i have already uploaded in self-hosted dify via docker #30628
Replies: 3 comments 3 replies
-
|
You can access the original uploaded document file in a Code node by using the signed URL provided in the file metadata. In Dify workflows, uploaded files are exposed as variables (often in import requests
# Suppose 'file_info' is the file metadata dict passed to your code node
file_url = file_info['url'] # This is the signed download URL
response = requests.get(file_url)
response.raise_for_status()
file_bytes = response.content
# Now you can process file_bytes as needed (e.g., pass to another library)If you have multiple files, iterate over If the Direct access to the backend storage filename (the randomized file in your Docker volume) is not exposed by default for security reasons. If you need to pass the backend filename to another system, you can modify the Dify backend code to include the Code nodes run in a sandboxed environment and cannot access the file system directly or import backend modules—use the signed URL approach for file access. For dataset documents, there is also an API endpoint that returns a signed download URL, but this is only for files attached to datasets, not general workflow uploads. This signed URL method is the recommended and secure way to programmatically retrieve and manipulate uploaded files in Dify workflows. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
@dosubot but this link have expirations i need link which i can access whenever i wanted and also wanted to know how much expiration is there on signed file link and can we increase via env or by anything |
Beta Was this translation helpful? Give feedback.
-
|
In the Code node, you can access uploaded files via their URL. The file info passed to your workflow includes a Example in Code node: import requests
def main(file_url: str) -> dict:
response = requests.get(file_url)
content = response.content
# do your processing here
return {"result": "processed"}The files are stored in the If you need the raw path, check your volume mapping - typically Does that help? |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Dify team
I’m using self-hosted Dify via Docker and have already uploaded documents to the system. I’m able to retrieve and process the content using the Document Extractor node.
However, I’d like to access the original uploaded file itself inside a Code node, so I can manipulate it directly using Python (for example, read the file, transform it, or pass it to another library).
Is there a supported way to:
Access the uploaded document file from a Code node?
Obtain a file path, file object, or build a URL for the uploaded document?
Or otherwise programmatically retrieve the raw file within a workflow?
If this isn’t currently supported, any recommended workaround would be appreciated.
Thanks in advance!
@dosubot
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions