Skip to content

Instantly share code, notes, and snippets.

@hikilaka
Created January 24, 2017 21:09
Show Gist options
  • Save hikilaka/5924a9cffc6706a44534958ffad52314 to your computer and use it in GitHub Desktop.
Save hikilaka/5924a9cffc6706a44534958ffad52314 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "no parameter passed, must pass image to upload"
exit 1
fi
FILE=$1
POSTURL="http://bacs.bounceme.net/uploads/index.php"
COUNTER=0
if [ ! -e "$FILE" ]; then
echo "the file '$FILE' does not exist"
exit 1
fi
if [ ! -f "$FILE" ]; then
echo "$FILE is not a regular file"
exit 1
fi
cp "$FILE" "$COUNTER$FILE"
while :; do
curl -X POST -F "file1=@$COUNTER$FILE" $POSTURL
LAST="$COUNTER$FILE"
COUNTER=$((COUNTER+1))
mv "$LAST" "$COUNTER$FILE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment