문제

I have String data and image files to send in an HttpServletResponse. How can this be done? i know how to send String and image separately. Couldn't see a MIME format to send both.

TIA.

도움이 되었습니까?

해결책

This is not possible, as a single HTTP response can only send a single file. However, you can embed an image using the data: URI scheme by creating an image similar to:

<img src = "data:image/png;base64,<data>" />

where <data> is the image encoded as base-64.

Of course, you can always store the image and serve it in a separate request initiated by the browser when it comes across your image tag, especially for large images.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top