user1844840
user1844840

Reputation: 2087

Give the option to save the image

My service call returns the image.

It returns the png image and it has content-type in header as image/jpeg , it opens the image in the same page. I want to give the option to the user to save this image to the disk.

Upvotes: 0

Views: 97

Answers (2)

vels4j
vels4j

Reputation: 11298

Content-Disposition may be inline, specify content-disposition as attachement

response.setContentType("image/jpeg");
response.setHeader("Content-Disposition", "attachment; filename=" + imageName + ".jpg");

Upvotes: 1

Sergey Vedernikov
Sergey Vedernikov

Reputation: 7744

You need Content-Disposition header in server's response

For example

Upvotes: 1

Related Questions