Some APIs and object endpoints accept a request body taken directly from a local file instead of a browser-style form upload. In those cases, wget can be enough to send the payload, capture the response, and prove the write succeeded without introducing another client into the workflow.

The relevant options are --post-file for POST requests and the --method plus --body-file pair for other verbs such as PUT. Add --header when the endpoint expects a specific Content-Type, and use --output-document to save the response body for later inspection. GNU documentation is explicit that these options do not implement browser-style multipart/form-data uploads.

This pattern sends the file contents as the HTTP request body. GNU documents these switches as form-style body helpers, but live verification showed that wget still transmitted the file contents exactly as stored, so raw-body endpoints worked when the method and Content-Type matched the API contract. Browser form uploads that expect multipart encoding still need another client, and write methods such as PUT should be treated carefully because they often replace the remote object at that path.

Steps to upload file contents with wget:

  1. Create the local payload file that will be sent as the request body.
    $ printf 'asset manifest batch=nightly\n' > asset-manifest.txt
    $ ls -l asset-manifest.txt
    -rw-r--r-- 1 user user 29 Mar 29 09:12 asset-manifest.txt

    This workflow is best for files whose contents should become the full HTTP body, such as plain text manifests, JSON, or API payload fragments.

  2. Send the file contents with an HTTP POST request and save the server response.
    $ wget --post-file=asset-manifest.txt \
      --header='Content-Type: text/plain' \
      --output-document=import-response.json \
      https://uploads.example.test/v1/imports/manifests
    --2026-03-29 09:12:14--  https://uploads.example.test/v1/imports/manifests
    Resolving uploads.example.test (uploads.example.test)... 198.51.100.42
    Connecting to uploads.example.test (uploads.example.test)|198.51.100.42|:443... connected.
    HTTP request sent, awaiting response... 202 Accepted
    Length: 279 [application/json]
    Saving to: 'import-response.json'
    
         0K                                                       100% 28.7M=0s
    
    2026-03-29 09:12:14 (28.7 MB/s) - 'import-response.json' saved [279/279]

    --post-file reads the file from disk and sends its contents in the POST body exactly as stored.

  3. Inspect the saved response to confirm the method, content type, and byte count the server received.
    $ sed -n '1,12p' import-response.json
    {
      "import_id": "imp_01JVDBK6YQCFM4D2W0Y6N6A4QZ",
      "status": "accepted",
      "path": "/v1/imports/manifests",
      "content_type": "text/plain",
      "bytes": 29,
      "sha256": "542a4cd76f5fb8665c7f422301590a8a90896253054af349365d0f4a02c7df80",
      "received_at": "2026-03-29T09:12:14Z"
    }

    An accepted status plus an echoed byte count or digest is a strong confirmation that the endpoint received the same body stored in the local file.

  4. Send the same file contents with PUT when the endpoint expects an idempotent object write.
    $ wget --method=PUT \
      --body-file=asset-manifest.txt \
      --header='Content-Type: text/plain' \
      --output-document=object-response.json \
      https://uploads.example.test/v1/objects/manifests/current.txt
    --2026-03-29 09:12:15--  https://uploads.example.test/v1/objects/manifests/current.txt
    Resolving uploads.example.test (uploads.example.test)... 198.51.100.42
    Connecting to uploads.example.test (uploads.example.test)|198.51.100.42|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 209 [application/json]
    Saving to: 'object-response.json'
    
         0K                                                       100% 25.8M=0s
    
    2026-03-29 09:12:15 (25.8 MB/s) - 'object-response.json' saved [209/209]

    PUT commonly replaces the remote resource at that path, so the target URL should identify the exact object that is meant to be updated.

  5. Confirm that the server returned a success status code for the write request.
    $ wget --server-response --quiet \
      --method=PUT \
      --body-file=asset-manifest.txt \
      --header='Content-Type: text/plain' \
      --output-document=/dev/null \
      https://uploads.example.test/v1/objects/manifests/current.txt 2>&1 | grep 'HTTP/'
      HTTP/1.1 200 OK

    The same pattern can work for binary payloads when the endpoint expects a raw request body and the correct Content-Type is supplied, but wget still does not provide multipart form uploads.