User6996
User6996

Reputation: 3003

get a different file name

How do i get a different file name on a webserver by requesting the url.

for example "file" click url link and get "file.bin"

the "file" is located on a webserver by requesting the url, user can download "file.bin" instead of "file"

something like (file + .bin)

Upvotes: 0

Views: 150

Answers (1)

Vaishak Suresh
Vaishak Suresh

Reputation: 5845

When you are sending the response from the server, you can set the content type, content disposition etc. Set the file name in the response header as below

response.setContentType("application/pdf");
response.setHeader("Content-disposition", "attachment;filename=testFile.pdf");

Upvotes: 1

Related Questions