working version of upload.sh