Basj
Basj

Reputation: 46267

Download a file with a parameter in URL

I noticed that downloading a file on a Apache server with:

example.com/myfile.zip?parameter=2365

gives exactly the same result / same downloaded file / same downloaded filename on client browser as downloading:

example.com/myfile.zip

Is it a supported and documented feature of Apache?

I am happy with it, and this will be useful for tracking purposes (I can ship download links with parameters ?source=email and then I will be able to see the parameter in Apache logs, this is useful!), but I wanted to be sure it will work on all browsers (Chrome, Firefox, IE, Safari, etc.)

Note: Are we sure that on most browsers, the downloaded file will have filename myfile.zip and not myfile.zip<somechar>parameter=2365? I tried wget example.com/myfile.zip?parameter=2365 and unfortunately the filename on disk is myfile.zip?parameter=2365, so it doesn't work well with wget.

Upvotes: 0

Views: 4268

Answers (1)

arco444
arco444

Reputation: 22861

It's a query string, if there's nothing configured to analyse the parameters then the server will just return the file.

As you've noticed, the Apache logs will include this information if they are configured to. It's perfectly safe to use that syntax, it is defined as part of the URI specification.

Upvotes: 1

Related Questions