开发者

ics file mime type

开发者 https://www.devze.com 2022-12-19 01:37 出处:网络
I\'m trying to upload an ics file to my site. It was exported from iCal on Mac开发者_JAVA百科 OSX. I thought that ics files had a mime type of text/calendar, but for some reason this file seems to be

I'm trying to upload an ics file to my site. It was exported from iCal on Mac开发者_JAVA百科 OSX. I thought that ics files had a mime type of text/calendar, but for some reason this file seems to be of type Application/octet-stream. This makes the upload fail my verification tests. Anyone have any ideas why the type isn't what I expect?!


Try adding a content-type of text/calendar to the header. If you are just serving it up from Apache you can look for instruction here: http://httpd.apache.org/docs/1.3/mod/mod_mime.html


The MIME type is determined by the browser, and seemingly, your browser doesn't know the proper MIME type for an ics file. Never mind, just skip the MIME check and do some structural analysis (Is there a valid header, are any calendar records present, etc.)

The MIME type is of very limited use for validation anyway, as it can be freely modified by the client.


I'll add my two cents. Browsers in general look at the headers the server sends them to determine MIME type. If no MIME type is sent by the server, good browsers guess, all IE generally do not. The link to the apache docs above posted by jckdnk111 is a good resource.

0

精彩评论

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