added directory check to upload script