Which HTTP method to use for file downloading?

Erik picture Erik · May 3, 2013 · Viewed 12.5k times · Source

In my site users can download their files. But files are generated by using PHP. So what's HTTP method should I use for sending request for download as file attachment? GET or POST?

Answer

deceze picture deceze · May 3, 2013

GET is for passively retrieving files, POST is for altering information on the server. This is as seen from the client, it doesn't matter what the server does or doesn't do in the process.

So unless you're altering some server state in the request: GET.