开发者

How to send a image to a client from my HTTP Server?

I am building a small http server. I am able to send html,css,xml files to the client over HTTP. But I am not able to send image 开发者_开发问答files-.jpg,.png.gif. How do I send it so the browser is able to display the image.

Thanks.


Send it just like any other (binary-data) file, with the correct Content-Type and Content-Length headers.

Content-Type for:

  • JPEG: image/jpeg
  • PNG: image/png
  • GIF: image/gif


You probably should set correctly the MIME type of your image.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜