summaryrefslogtreecommitdiffstats
path: root/files/.bin/file_upload.sh
blob: 0ff6c57d32dd7264071b6cdfffb022ac2c84cc8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

BOLD="\e[1";
ENDCOLOR="\e[0m";
Green="32m";
LightRed="31m";

echo ""
echo -e $BOLD";"";"$Green" FILE UPLOADER"$ENDCOLOR
echo ""

if ! [ $1 ]; then
    echo ""
    echo -e $BOLD";"";"$LightRed" Please provide file path!"$ENDCOLOR
    echo ""
    exit
fi

if [ $1 ]; then
    echo -e " Are u sure u want upload this file: "$BOLD";"";"$Green" '$1'"$ENDCOLOR"? [y/N]: "
    read -p " " input
    echo ""
    # read -r -p " " input
    case $input in
	[yY][eE][sS]|[yY])
	    URL=$(curl -s -F "file=@$1" https://0x0.st);
	    echo -e " URL: "$BOLD";"";"$Green"$URL"$ENDCOLOR;
	    ;;
	[nN][oO]|[nN])
	    echo -e $BOLD";"";"$Green" OK"$ENDCOLOR;
	    ;;
	*)
	    echo -e $BOLD";"";"$LightRed" Invalid input..."$ENDCOLOR;
	    exit 1
	    ;;
    esac
    echo ""
fi;