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,937
  • 3
  • 16
  • 13

2 Answers2

1

You need Content-Disposition header in server's response

For example

Sergey Vedernikov
  • 7,609
  • 2
  • 25
  • 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,208
  • 5
  • 38
  • 63