form_post - Linux


form_post is a versatile command-line tool designed to facilitate the sending of POST requests with multipart data to web servers. It excels in automating the process of uploading files, submitting forms, and interacting with APIs that require complex request bodies.


form_post [options] <url> -f <file> -d <key=value>...


  • -f <file>: Path to the file to be uploaded. Multiple files can be specified by repeating this option.
  • -d <key=value>: Data pairs to include in the POST request body. Multiple key-value pairs can be supplied.
  • -H <header>: Custom HTTP headers to set in the request. Can be used multiple times.
  • -u <username:password>: HTTP Basic Authentication credentials.
  • -k: Disable SSL/TLS certificate verification.
  • -v: Enable verbose output for debugging.
  • -h: Display help information.


Upload a File:

form_post -f my_file.txt

Submit a Form:

form_post -d name=John -d

Send Custom Headers:

form_post -H "Content-Type: application/json" -H "Authorization: Bearer 123"

Common Issues

  • Permission Denied: Ensure that the file to be uploaded has the necessary read permissions.
  • Connection Timeout: Increase the connection timeout using the --connect-timeout option.
  • SSL Certificate Verification Error: Use the -k option to disable certificate verification if the server’s certificate is self-signed or invalid.


Combining with Other Commands:

curl \
  --data "`form_post -d key=value | base64`"

Using with Scripts:


# Read data from a file
form_post -f "$1" \
  | while read line; do
      echo "$line" >> log.txt

Related Commands

  • curl: General-purpose HTTP client
  • httpie: Interactive HTTP client
  • postman: GUI-based HTTP client