You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

teknikupload.sh 600B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # name: teknik-upload
  3. # creator: KittyKatt
  4. # requires: bash 4.0+, curl
  5. files="$@"
  6. if [[ -z "${files}" ]]; then
  7. printf 'You must submit a file to be uploaded!\n'
  8. exit 1
  9. else
  10. printf 'Uploading file(s) now!'
  11. n=1
  12. for i in "$@"; do
  13. printf "\nUploading file #${n} ... "
  14. out=$(curl -sf -F file="@${i}" https://api.teknik.io/upload/post)
  15. if [[ "${out}" =~ "error" ]]; then
  16. printf 'error uploading file!\n'
  17. exit 1
  18. else
  19. out="${out##*name\":\"}"
  20. out="${out%%\"*}"
  21. printf "uploaded! Your file can be found at https://u.teknik.io/${out}\n"
  22. fi
  23. ((n++))
  24. done
  25. fi