ComfyUI Node

HTTP File Upload

Ship a local file to any API endpoint

By wawahuy·Created about a year ago·Updated 11 months ago· 14
HTTP File Upload
  • session
  • auth
  • status_code
  • headers
  • content
  • json
urlhttps://api.example.com/upload
file_path/path/to/file.txt
field_namefile
headers{}
additional_data{}
filename
content_type
timeout60
verify_ssltrue
allow_redirectstrue
cookies{}
proxy_url
chunk_size8192

Sometimes you don't want to post JSON - you want to post a file. Maybe it's a prompt you generated and saved, a zip of outputs, a config file your workflow built, or just about anything else sitting in a path on disk. HTTP File Upload is the pack's blunt instrument for that: point it at a file path, tell it the multipart field name the server expects, and it uploads via POST with multipart/form-data.

How it works

Under the hood it reads the file, builds a files dict with (filename, bytes, content_type), and posts it - with the same session/auth/header plumbing as every other node in this pack. Three required inputs:

  • url - where the file goes.
  • file_path - the local path. The node checks it exists and returns an error message instead of crashing if it doesn't.
  • field_name - the form field name the API expects (usually file).

Then the useful optional ones:

  • filename - leave blank and it's auto-derived from file_path via os.path.basename.
  • content_type - leave blank and it's auto-detected from the extension (text, json, pdf, images, video, audio are covered; anything unknown becomes application/octet-stream).
  • additional_data - a JSON object of extra form fields sent alongside the file.
  • session, auth, headers, cookies, timeout (default 60s - uploads get more headroom than the 30s on plain requests), verify_ssl, proxy_url.

Outputs are the standard four: status_code, headers, content, json.

The honest caveat

The README sells this with "progress and configuration," and there's a chunk_size input (default 8192, up to 1 MB). It doesn't actually stream in chunks - the code reads the whole file into memory and sends it in one shot. For the sizes you're usually moving in ComfyUI that's totally fine, but don't reach for it to push a 2 GB video. For big files, use HTTPFormFileItem inside a form instead, or better, upload from outside ComfyUI.

Install

ComfyUI Manager → search "ComfyUI-HTTP" → Install, then restart. Manual:

cd ComfyUI/custom_nodes/
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
cd ComfyUI-HTTP
pip install -r requirements.txt

No models, nothing heavy - just requests.

Where people get burned

The classic miss is the field name. The server expects name="file", you leave the default, and you get a 400 because the API actually wanted name="upload". Set field_name to match the endpoint's docs. And remember the no-throw behavior: a failed upload returns status_code = 0 with the error text in content, so check the status before you assume the file landed.

CategoryHTTP/File Operations

Inputs (15)

NameTypeDefaultDescription
urlSTRINGhttps://api.example.com/upload
file_pathSTRING/path/to/file.txt
field_nameSTRINGfile
sessionoptHTTP_SESSION
authoptHTTP_AUTH
headersoptSTRING{}
additional_dataoptSTRING{}
filenameoptSTRING
content_typeoptSTRING
timeoutoptINT601–300
verify_ssloptBOOLEANtrue
allow_redirectsoptBOOLEANtrue
cookiesoptSTRING{}
proxy_urloptSTRING
chunk_sizeoptINT81921024–1048576

Outputs (4)

NameTypeDescription
status_codeINT
headersSTRING
contentSTRING
jsonSTRING