I need to download a file from a URL except I don’t know what type the file will be and the URL I am using doesn’t have /random.file at the end of it so I can’t parse the url for the filename.
At the moment I’m using the Android download manager which works greats and means I don’t have handle the download but I can’t see anyway to get the file name out of the file its downloading. If I load the same url in Firefox for example it asks ‘Download file: Nameoffile.extension’.
Is there a way for me to replicate this behaviour and get the file name before I download the file?
I ended up using an ASyncTask to manually retrieve the file name and passing it to the download manager, if it helps anyone this is how I did it (my url went through a number of redirects before the actual file download):