
CURL_URL=${DERG_UPLOAD_URL:-https://lucidragons.de/api/admin/upload}
CURL_KEY=${DERG_UPLOAD_KEY:-SoftDragonKeys}

for FILE_PATH in "$@"
do
    if [ -f "${FILE_PATH}" ]; then
        POST_PATH="/${FILE_PATH#"./"}"

        echo "Uploading ${FILE_PATH} to ${POST_PATH}"

        curl -i -X POST -H "Content-Type: multipart/form-data"  \
            -F "api_key=${CURL_KEY}" -F "post_path=${POST_PATH}" -F "post_data=@${FILE_PATH}" "${CURL_URL}"
    fi
done