-
-
Save hugomaiavieira/255468d778c427b6ff35 to your computer and use it in GitHub Desktop.
Upload files to upl.io through command line
This file contains hidden or 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
# This command receives a file as param, upload it to upl.io and copy the url to | |
# the clipboard | |
# | |
# Dependencies: curl and xclip | |
# | |
# Install: copy this code to your .bashrc or .zshrc | |
# | |
# Example: | |
# | |
# $ upload_file ~/Images/algorich-logo.png | |
# Uploading... | |
# http://upl.io/mgun63 | |
# | |
upl() { | |
local url | |
local curl_response | |
echo 'Uploading...' | |
url=`curl http://upl.io -F file=@$1 -s -f` | |
curl_response=$? | |
echo -n $url | xclip -selection c | |
echo $url | |
if [[ "$curl_response" = '0' ]] && [[ "$2" = '-d' ]]; then | |
rm $1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I notice they no longer allow anonymous uploads.
Is there a way to specify api user key on the command line?
edit: figured it out
get your $UPLIO_KEY from the Dashboard after logging in
or