Some HTTP endpoints accept a local file as the entire request body instead of a browser-style form upload. In that case, wget can send the file contents directly and show the server response without switching to another client.
The main switches are --post-file for POST requests and --method plus --body-file when the endpoint expects another verb such as PUT. Add --header when the server requires a specific Content-Type so the receiver knows whether the bytes are text, JSON, form data, or another media type.
GNU wget sends every byte from the chosen regular file as the request body, including trailing newlines. It does not build multipart/form-data file fields, so use another client when the endpoint expects a browser-style form upload. Avoid redirecting write requests because a redirected custom method can fall back to GET unless the server keeps the method with 307 Temporary Redirect.
$ cat > upload.txt <<'EOF' release=2026.04 channel=stable EOF
--post-file and --body-file require a regular file because wget needs the request body length before it sends the upload.
$ wget -qO- \ --header='Content-Type: text/plain' \ --post-file=upload.txt \ https://httpbin.org/post { "args": {}, "data": "release=2026.04\nchannel=stable\n", "files": {}, "form": {}, "headers": { "Accept": "*/*", "Accept-Encoding": "identity", "Content-Length": "31", "Content-Type": "text/plain", "Host": "httpbin.org", "User-Agent": "Wget/1.25.0" }, ##### snipped ##### "url": "https://httpbin.org/post" }
The echoed body and Content-Type confirm that wget transmitted the contents of upload.txt as the raw request body.
$ wget -qO- \ --method=PUT \ --body-file=upload.txt \ --header='Content-Type: text/plain' \ https://httpbin.org/put { "args": {}, "data": "release=2026.04\nchannel=stable\n", "files": {}, "form": {}, "headers": { "Accept": "*/*", "Accept-Encoding": "identity", "Content-Length": "31", "Content-Type": "text/plain", "Host": "httpbin.org", "User-Agent": "Wget/1.25.0" }, ##### snipped ##### "url": "https://httpbin.org/put" }
Use the final write URL whenever possible because a redirected custom method can switch to GET unless the server replies with 307 Temporary Redirect.
$ rm -f upload.txt