How to get wget to use the correct filename

From this AskUbuntu question:

wget --content-disposition http://blahblah...

The --content-disposition flag seems to make wget look at the server headers and retrieve the filename from the header of the same name.

To see the server headers returned, use the -S flag to wget:

Content-Disposition: filename=foo_file.pdf
Add picture from clipboard (Maximum size: 1 GB)