Is there a way to get the size of a remote file http://my_url/my_file.txt without downloading the file?
Sure. Make a headers-only request and look for the Content-Length header.
Content-Length