Fix the progress listener when downloading files

The progress listener was relying on the size of the local file, both for uploads and downloads. This produces a division by zero when the file doesn't exist. When downloading files, the file length should be obtained from the remote object metadata.