ComfyUI Node

HTTP Form File Item

Drop a file from disk into your multipart form

By wawahuy·Created about a year ago·Updated 11 months ago· 14
HTTP Form File Item
    • form_item
    namefile
    file_path/path/to/file.txt
    filename
    content_type

    Multipart forms often need a file sitting somewhere on disk - a document, a config, an audio clip - alongside their text fields. HTTP Form File Item is the node that picks that file up and turns it into one item of a multipart body. It's the disk-based cousin of HTTP Form Image Item, and the two cover the "send actual bytes" half of form building.

    How it works

    Two required inputs:

    • name - the form field name (defaults to file).
    • file_path - the absolute path to the file you want to attach.

    And two optional inputs that do most of the convenience work:

    • filename - leave it blank and it's taken from the end of file_path automatically.
    • content_type - leave it blank and it's auto-detected from the file extension. The mapping covers the usual suspects: text, json, xml, pdf, jpg/png/gif/bmp/webp, mp4/avi, mp3/wav. Anything unknown falls back to application/octet-stream.

    One output: form_item (HTTP_FORM_ITEM), which plugs into an HTTP Form Data slot. When the form is sent, the file is read and included in the files part of the multipart body under its name.

    The right workflow

    [HTTP Form File Item] ─┐
                            ├→ [HTTP Form Data] → [HTTP Post: form-data]
    [HTTP Form Text Item] ──┘
    

    The file path matters here - it's whatever path your OS sees, not a ComfyUI input. /path/to/file.txt in the default is a placeholder; put in something real or the upload will quietly fail.

    Install

    ComfyUI Manager → search "ComfyUI-HTTP" → Install, 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, no extra dependencies.

    Where people get burned

    The big one: a missing or mistyped file_path doesn't error the workflow. The form container catches the read failure and stuffs a File not found: <path> string into the text-data part of the form, and the API receives a text field where it expected a file - usually a confusing 400 or 422. Check paths before you run. Second: while HTTP File Upload (the standalone node) sends one file and some additional_data, this node is the one to use when the file is one of several fields in a bigger form - if your endpoint takes a file plus multiple text fields, go this route.

    CategoryHTTP/Form Data

    Inputs (4)

    NameTypeDefaultDescription
    nameSTRINGfile
    file_pathSTRING/path/to/file.txt
    filenameoptSTRING
    content_typeoptSTRING

    Outputs (1)

    NameTypeDescription
    form_itemHTTP_FORM_ITEM