Only get the remote file name before upload

Fixes #8