function formdata_pipeline(){
    filename="wiebitte114514.txt"
    mimetype="text/plain"
    echo -n $'-----------------------------11451419198108932147483647\r\nContent-Disposition: form-data; name="file"; filename="wiebitte114514.txt"'
    echo -n $'\r\nContent-Type: text/plain'$'\r\n\r\n'
    cat -
    echo -n $'\r\n-----------------------------11451419198108932147483647--\r\n'
}

function upload(){
    curl 'https://media.guilded.gg/media/file_upload?dynamicMediaTypeId=ContentMediaGenericFiles' -X POST -H 'Content-Type: multipart/form-data; boundary=---------------------------11451419198108932147483647' --data-binary "@-" | sed 's/?.*//g;s/"/\n/g' | grep http
}

cat - | formdata_pipeline | upload

