Created
September 14, 2020 23:53
-
-
Save jonlabelle/8cbd78c9277e76cb21a142f0c556e939 to your computer and use it in GitHub Desktop.
Upload to file.io shell script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ======================================================== | |
# 100 uploads per day, 5GB file size limit for FREE plan. | |
# ======================================================== | |
URL="https://file.io" | |
DEFAULT_EXPIRE="14d" # Default to 14 days | |
if [ $# -eq 0 ]; then | |
printf "Usage: file.io.sh FILE [DURATION]\n" | |
printf "Example: file.io.sh path/to/my/file 1w\n" | |
exit 1 | |
fi | |
FILE=$1 | |
EXPIRE=${2:-$DEFAULT_EXPIRE} | |
if [ ! -f "$FILE" ]; then | |
echo "File ${FILE} not found" | |
exit 1 | |
fi | |
RESPONSE=$(curl -# -F "file=@${FILE}" "${URL}/?expires=${EXPIRE}") | |
echo "${RESPONSE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment