ily.li/assets/files/upload_file.sh

19 lines
294 B
Bash
Raw Normal View History

#!/bin/sh
local_file=$1
2020-07-06 10:49:18 +02:00
slug=$2
token=$(cat "$HOME/.ily_token")
2020-07-06 10:49:18 +02:00
if test -z "$slug"; then
method=POST
else
2020-07-06 10:49:18 +02:00
method=PUT
fi
2020-07-06 10:49:18 +02:00
curl -X $method -H 'Accept: text/plain' \
-H "Authorization: $token" \
-F 'type=file' \
-F "upload=@$local_file" \
-F 'ttl=2592000' \
"https://ily.li/$slug"