Google-chrome – How to download a file from a URL

downloadgoogle-chromehtml

But let's say I have a URL, and it's either a SWF, a PNG or an MP3 or something. How can I force my browser (in this case I'm using Google Chrome) to download the file, instead of automatically displaying/playing it?

My quirky way around this is to create a one line HTML file with a hyperlink inside it pointing to the URL, then right click and save link as. But there has to be a better way to do this. I just can't find it by Googling.

Best Answer

Download File from URL

There are a couple ways to do this. As mentioned, using the developer tools could work (more likely it will give you the url to the file) and right-clicking the link will work. Alternatively there are these options.

In Chrome

  1. Go to the URL
  2. Right-click the webpage
  3. Select Save As...

For verification purposes, here are png, jpg, and mp3 links. Follow them and try these steps. However, in my experience. If you already have a url to a file, opening up Chrome and following these steps is rather tedious so here is an alternative.

In Command Line

  1. Open your favorite terminal emulator
  2. type curl -o myfile.mp3 'www.foo.com/bar.mp3'
  • Where myfile.mp3 is what you want to call the file you're downloading
  • And www.foo.com/bar.mp3 is the URL to the file

[Note: This works for Linux and Mac users. If you are unfortunate enough to be a Windows user trying to use the cmd line, use Cmder and this method will work or if you're a purist try this]

Related Question