ASM-2182 fix variable ordering for upload_file case

The path and cwd variables were being set after they were used for the
upload_file case, causing that to fail.