upload (964B)
1 #!/usr/bin/env sh 2 3 # Description: Upload to Firefox Send if ffsend is found, else 4 # Paste contents of a text a file http://ix.io 5 # Upload a binary file to file.io 6 # 7 # Dependencies: ffsend (https://github.com/timvisee/ffsend), curl, jq, tr 8 # 9 # Note: Binary file set to expire after a week 10 # 11 # Shell: POSIX compliant 12 # Author: Arun Prakash Jana 13 14 if [ -n "$1" ] && [ -s "$1" ]; then 15 if type ffsend >/dev/null 2>&1; then 16 ffsend -fiq u "$1" 17 elif [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "text" ]; then 18 curl -F "f:1=@$1" ix.io 19 else 20 # Upload the file, show the download link and wait till user presses any key 21 curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"' 22 23 # To write download link to "$1".loc and exit 24 # curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc 25 fi 26 else 27 printf "empty file!" 28 fi 29 30 read -r _