Skip to content

Instantly share code, notes, and snippets.

@jonlabelle
Created September 14, 2020 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonlabelle/8cbd78c9277e76cb21a142f0c556e939 to your computer and use it in GitHub Desktop.
Save jonlabelle/8cbd78c9277e76cb21a142f0c556e939 to your computer and use it in GitHub Desktop.
Upload to file.io shell script.
#!/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