Any way to guess the mime type on Delphi XE2?

前端 未结 4 853
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-08 13:09

I need to guess the mime type with the purpose of fill the \"Content-Type\" header for some file uploads.

I fail to found a solution for it.

I wish to call somet

4条回答
  •  隐瞒了意图╮
    2021-02-08 13:30

    Internet Direct (Indy) contains a class for this:

    class TIdThreadSafeMimeTable

    in unit IdCustomHTTPServer

    Code example in a HTTP server application:

    Response.ContentType :=
      Response.HTTPServer.MIMETable.GetFileMIMEType(FileName);
    

提交回复
热议问题