Removed $totalBytes. fread() does not play nice with remote files ($chunkSize is the *maximum* number of bytes)