0
我有MIME作爲字符串和httpheader我怎樣才能從http頭獲得擴展名的文件名或簡單地說有沒有什麼辦法從MIME中獲得擴展名?帶有MIME字符串擴展名的文件名
如: MIME,Extension
`application/octet-stream class`
`application/octet-stream dms`
` application/octet-stream exe`
`application/octet-stream lha`
以上具有相同的MIME字符串,但不同的擴展
這些都是我從httpHeader
得到一個zip文件
Keep-Alive : timeout=10
Connection : Keep-Alive
Age : 4418
Accept-Ranges : bytes
ETag : "ee0043-157f-4acf6ff5c1640"
Cache-Control : max-age=10800, s-maxage=10800
x-mii-cache-hit : 1
X-Pb-Mii : Powered by Mirror Image Internet
Via : 1.1 sjc005158 (MII-APC/2.3), 1.1 sjc005112 (MII-APC/2.3)
Content-Length : 5503
Last-Modified : Thu, 15 Sep 2011 08:52:33 GMT
Date : Tue, 26 Nov 2013 08:30:27 GMT
Content-Type : application/zip
Server : MII-APC/2.4.5
我知道的第一種方式解析文件名和擴展名,那裏有重複的,因爲我在問題中提到。 。我沒有在標題中得到這些東西 –
如何解析URL以獲取文件名和擴展名? – gmanolache
可能沒有文件名或擴展名 –