Manage files
Each Langflow server has a file management system where you can store files that you want to use in your flows.
Files uploaded to Langflow file management are stored in Langflow's storage backend (local or AWS S3), and they are available to all of your flows.
Uploading files to Langflow file management keeps your files in a central location, and allows you to reuse files across flows without repeated manual uploads.
Use the file management UI
You can use the file management UI to upload files from your local machine to your own Langflow server. You can also manage all files that have been uploaded to your Langflow server.
-
Navigate to Langflow file management:
- Langflow Desktop: In Langflow, on the Projects page page, click My Files below the list of projects.
- Langflow OSS: From a browser, navigate to your Langflow server's
/filesendpoint, such ashttp://localhost:7860/files. Modify the base URL as needed for your Langflow server. - Backend-only: For programmatic file management, use the Langflow API files endpoints. However, the following steps assume you're using the file management UI.
-
On the My Files page, click Upload.
-
Select one or more files to upload.
After uploading files, you can rename, download, copy, or delete files within the file management UI. To delete a file, hover over a file's icon, select it, and then click Delete. You can delete multiple files in a single action. To download a file, hover over a file's icon, select it, and then click Download. If you download multiple files in a single action, they are saved together in a zip file.
Upload and manage files with the Langflow API
With the Langflow API, you can upload and manage files in Langflow file management, and you can send files to flows programmatically at runtime.
For more information and examples, see Files endpoints and Create a chatbot that can ingest files.
Set the maximum file size
By default, the maximum file size is 1024 MB.
To modify this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable.
Use files in a flow
To use files in your Langflow file management system in a flow, add a component that accepts file input to your flow, such as the Read File component.
For example, add a Read File component to your flow, click Select files, and then select files from the My Files list.
This list includes all files in your server's file management system, but you can only select file types that are supported by the Read File component. If you need another file type, you must use a different component that supports that file type, or you need to convert it to a supported type before uploading it.
For more information about the Read File component and other data loading components, see the Read file component.
Load files at runtime
You can use preloaded files in your flows, and you can load files at runtime, if your flow accepts file input. To enable file input in your flow, do the following:
-
Add a Read File component to your flow.
-
Click Share, select API access, and then click Input Schema to add
tweaksto the request payload in the flow's automatically generated code snippets. -
Expand the File section, find the Files row, and then enable Expose Input to allow the parameter to be set at runtime through the Langflow API.
-
Close the Input Schema pane to return to the API access pane. The payload in each code snippet now includes
tweakswith your Read File component's ID and thepathkey that you enabled in Input Schema:_10"tweaks": {_10"File-qYD5w": {_10"path": []_10}_10} -
When you run this flow programmatically, your script must upload a file to Langflow file management, and then pass the returned
file_pathto thepathtweak in the/runrequest:_10"tweaks": {_10"FILE_COMPONENT_ID": {_10"path": [ "file_path" ]_10}_10}For a complete example see Create a chatbot that can ingest files and Files endpoints.
If you want to upload multiple files, you can pass multiple
file_pathvalues in thepatharray, such as[ "path1", "path2" ].
Upload images
Langflow supports base64 images in the following formats:
- PNG
- JPG/JPEG
- GIF
- BMP
- WebP
You can upload images to the Playground chat interface and as runtime input with the Langflow API.
-
In the Playground, you can drag-and-drop images into the chat input area, or you can click the Attach image icon to select an image to upload.
-
When you trigger a flow with the
/api/v1/run/$FLOW_IDendpoint, you can use thefilesparameter to attach image data as a base64-encoded string:_10curl -X POST "http://$LANGFLOW_SERVER_ADDRESS/api/v1/run/$FLOW_ID" \_10-H "Content-Type: application/json" \_10-H "x-api-key: $LANGFLOW_API_KEY" \_10-d '{_10"session_id": "custom_session_123",_10"input_value": "What is in this image?",_10"input_type": "chat",_10"output_type": "chat",_10"files": ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."]_10}'
For more specialized image processing, browse [Bundles] or create your own components.
Work with video files
For videos, see the Twelve Labs and YouTube Bundles.
Configure file storage
Langflow supports two storage backends for file management:
-
Local storage: Langflow's default storage backend. Files are stored locally in your Langflow configuration directory. Set
LANGFLOW_STORAGE_TYPE=localor leave it unset to use local storage. -
S3 storage: Files are stored in an AWS S3 bucket. Langflow uses the boto3 library to interact with S3.
To use S3 as your file storage backend, add the following configuration to your .env file:
_10# S3 Storage Configuration_10LANGFLOW_STORAGE_TYPE=s3_10LANGFLOW_OBJECT_STORAGE_BUCKET_NAME=S3_BUCKET_NAME_10LANGFLOW_OBJECT_STORAGE_PREFIX=S3_BUCKET_DIRECTORY_10_10# AWS Credentials (required for S3)_10AWS_ACCESS_KEY_ID=S3_ACCESS_KEY_10AWS_SECRET_ACCESS_KEY=S3_ACCESS_SECRET_KEY_10AWS_DEFAULT_REGION=S3_REGION
Replace the following placeholders with the actual values for your S3 instance:
S3_BUCKET_NAME: The name of your S3 bucket.S3_BUCKET_DIRECTORY: An optional folder path within the bucket where files are stored, such ass3://S3_BUCKET_NAME/S3_BUCKET_DIRECTORY.S3_ACCESS_KEY: Your AWS Access Key ID.S3_ACCESS_SECRET_KEY: Your AWS Secret Access Key.S3_REGION: The AWS region where your bucket is located, such asus-east-2.
Your AWS credentials must have the necessary permissions to perform the required S3 operations for your use case, such as reading, writing, and deleting files in S3. This example policy allows basic CRUD operations on S3 objects.
_20{_20 "Version": "2012-10-17",_20 "Statement": [_20 {_20 "Sid": "LangflowS3StorageAccess",_20 "Effect": "Allow",_20 "Action": [_20 "s3:PutObject",_20 "s3:GetObject",_20 "s3:DeleteObject",_20 "s3:ListBucket",_20 "s3:PutObjectTagging",_20 ],_20 "Resource": [_20 "arn:aws:s3:::S3_BUCKET_NAME",_20 "arn:aws:s3:::S3_BUCKET_NAME/S3_BUCKET_DIRECTORY/*"_20 ]_20 }_20 ]_20}
Replace the following placeholders with the actual values for your IAM policy and S3 instance:
S3_BUCKET_NAME: The name of your S3 bucket.S3_BUCKET_DIRECTORY: An optional folder path within the bucket where files are stored, such ass3://S3_BUCKET_NAME/S3_BUCKET_DIRECTORY.
For more information, see the AWS documentation.
File storage environment variables
The following environment variables configure file storage backends for Langflow's file management system:
| Variable | Format | Default | Description |
|---|---|---|---|
LANGFLOW_STORAGE_TYPE | String | local | Set the file storage backend. Supported values: local (files stored in the Langflow configuration directory) or s3 (files stored in AWS S3). For S3 storage, you must also configure AWS credentials and bucket settings. |
LANGFLOW_OBJECT_STORAGE_BUCKET_NAME | String | Not set | The name of the S3 bucket to use for file storage. Required when LANGFLOW_STORAGE_TYPE=s3. |
LANGFLOW_OBJECT_STORAGE_PREFIX | String | Not set | Optional prefix/folder path within the S3 bucket where files will be stored. If not set, files are stored at the bucket root. |
LANGFLOW_OBJECT_STORAGE_TAGS | JSON object | Not set | Optional S3 object tags applied to stored files when LANGFLOW_STORAGE_TYPE=s3. Ignored for local storage. Provided as a JSON map of string keys to string values, such as {"env": "prod", "owner": "data-team"}. |