0

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.

user1844840
  • 1,817
  • 3
  • 14
  • 13

2 Answers2

1

You need Content-Disposition header in server's response

For example

Sergey Vedernikov
  • 7,433
  • 2
  • 24
  • 27
1

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

response.setContentType("image/jpeg");
response.setHeader("Content-Disposition", "attachment; filename=" + imageName + ".jpg");
vels4j
  • 11,026
  • 5
  • 39
  • 57