#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: ,sample <filename>"
    exit 1
fi

if [ ! -f "$1" ]; then
    echo "File not found: $1"
    exit 1
fi

mime_type=$(file --brief --mime-type "$1")

if [[ "$mime_type" != image/* ]]; then
    read -r -p "Detected $mime_type, not an image. Type yes to continue: " confirmation
    if [ "$confirmation" != "yes" ]; then
        echo "Upload cancelled."
        exit 1
    fi
fi

scp "$1" root@server.dochne.com:/srv/shared/sample.dochne.com/
