Get mime type from download, if download is a file name

Get mime type from the download parameter instead of from the file, if
download is a file name
Merge pull request #673 from jeorgen/mimetype_from_download

Get mime type from download, if download is a file name