From the look of it the following will work :
curl -F "Filedata=@cover_art.jpg;filename=cover_art.jpg;type=image/jpeg;" \
-F "token=61aa06d6116f7331ad7b2ba9c7fb707ec9b182e8" \
-F "upload_session=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-F "adult=0" "https://postimage.io/upload.php"
This gives a JSON result like :
{
"status": "OK",
"total_uploaded": 1,
"url": "\/\/postimg.org\/image\/4crb2b603\/9bfe3a80\/"
}
If you look at the https://postimage.io/ page you will find this :
var upload_session = rand_string(32);
It seems the server checks for exactly 32 characters for the upload_session
so : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.
The variable token
seems to be hardcoded (same for different request / IP / UA). Maybe it changes periodically or depending on other parameters so you can scrap it for instance using gawk:
curl -s "https://postimage.io/" | \
gawk 'match($0, /'\''token'\''\s+:\s+'\''(.*)'\''/, data) {print data[1]}'
or with grep :
curl -s "https://postimage.io/" | grep -oP "'token'\s+:\s+'\K(\w+)"
So the following script would work using curl, grep and jq (JSON parser), it returns the generated uri value :
token=$(curl -s "https://postimage.io/" | grep -oP "'token'\s+:\s+'\K(\w+)")
curl -s -F "Filedata=@cover_art.jpg;filename=cover_art.jpg;type=image/jpeg;" \
-F "token=$token" \
-F "upload_session=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-F "adult=0" "https://postimage.io/upload.php" | \
jq -r '"https:" + .url'