upload_file
Upload a local G-code file to your 3D printer via supported protocols, automatically selecting the correct method for Bambu, OctoPrint, Moonraker, or serial connections.
Instructions
Upload a local G-code file to the printer.
Handles FTPS (Bambu), REST multipart upload (OctoPrint/Moonraker), and
serial file transfer automatically.
Args:
file_path: Absolute path to the print file on the local filesystem.
The file must exist and be readable. Accepted extensions follow
the TARGET PRINTER, not one fixed list — ``printer_status()``
reports them per machine, and a Bambu declares ``.3mf`` FIRST
because that is the only thing it will start a print from.
Bare ``.gcode`` / ``.gco`` / ``.g`` is right for OctoPrint,
Moonraker, PrusaLink and Duet; on a Bambu it has no start block
and is refused by the homing gate below.
When ``slice_model`` produced the file, upload the path it names
in ``recommended_upload_path`` and do not choose between its
outputs by hand — it already knows the printer. (This docstring
used to say the extension had to be ``.gcode``, ``.gco`` or
``.g``, which is narrower than this function's own behaviour and
sent at least one caller to the one file its printer could not
print.)
printer_name: Which printer to upload to. Omit to upload to the
default printer, which is what this did before it could be
aimed. The G-code dialect scan and the bed-fit gate follow the
named machine too, so the bytes are checked against the bed
they are actually going to.
After a successful upload the file will appear in ``printer_files()`` and
can be started with ``start_print()``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| printer_name | No |