mime

How do I get File Type Information based on extension? (not MIME) in c#

假如想象 提交于 2019-11-27 08:22:16
How do I get the general File type description based on extension like Explorer does it? So not MIME but the information that the end-user sees, like. .doc = Microsoft Office Word 97 - 2003 Document .zip = ZIP File .avi = Video File. And how can I get the 'secondary' information that seems to be available, which I guess it not extension based. Like on "Video Files" it can give you the 'Length' of the movie or on doc files how many pages it has.. etc etc.. Thanks Dan, Alright.. This answers the first question I had. Sadly not the second. Note: Not everything prints.. Credits to PInvoke.net

IIS 添加MIME类型

好久不见. 提交于 2019-11-27 08:18:59
1、添加网站支持的MIME类型:   MIME类型就是设定某种扩展名的文件用一种应用程序来打开的方式类型,当该扩展名文件被访问的时候,浏览器会自动使用指定应用程序来打开。 (1)在网站中找到其MIME类型标签 (2)点击进去,右键”添加“,添加相应的后缀名以及相应程序,如图以CAD数据".dwg"为例: 来源: https://blog.csdn.net/guzicheng1990/article/details/99599407

How can I encode a filename in PHP according to RFC 2231?

耗尽温柔 提交于 2019-11-27 08:04:09
问题 How can I encode the value of a filename according to the encoding of MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations (RFC 2231)? 回答1: I think this should do it: function rfc2231_encode($name, $value, $charset='', $lang='', $ll=78) { if (strlen($name) === 0 || preg_match('/[\x00-\x20*\'%()<>@,;:\\\\"\/[\]?=\x80-\xFF]/', $name)) { // invalid parameter name; return false; } if (strlen($charset) !== 0 && !preg_match('/^[A-Za-z]{1,8}(?:-[A-Za-z]{1,8}

ISO 8859-1 filename not decoding

纵然是瞬间 提交于 2019-11-27 07:56:48
问题 I'm extracting files from MIME messages in a python milter and am running across issues with files named as such: =?ISO-8859-1?Q?Certificado=5FZonificaci=F3n=5F2010=2Epdf?= I can't seem to decode this name into UTF. In order to solve a prior ISO-8859-1 issue, I started passing all filenames to this function: def unicodeConvert(self, fname): normalized = False while normalized == False: try: fname = unicodedata.normalize('NFKD', unicode(fname, 'utf-8')).encode('ascii', 'ignore') normalized =

How should I detect the MIME type of an uploaded file in ASP.NET?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 07:50:29
How do people usually detect the MIME type of an uploaded file using ASP.NET? in the aspx page: <asp:FileUpload ID="FileUpload1" runat="server" /> in the codebehind (c#): string contentType = FileUpload1.PostedFile.ContentType The above code will not give correct content type if file is renamed and uploaded. Please use this code for that using System.Runtime.InteropServices; [DllImport("urlmon.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)] static extern int FindMimeFromData(IntPtr pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, [MarshalAs(UnmanagedType

Is Content-Transfer-Encoding an HTTP header?

浪尽此生 提交于 2019-11-27 07:33:50
I'm writing a web service that returns a base64-encoded PDF file, so my plan is to add two headers to the response: Content-Type: application/pdf Content-Transfer-Encoding: base64 My question is: Is Content-Transfer-Encoding a valid HTTP header? I think it might only be for MIME. If not, how should I craft my HTTP response to represent the fact that I'm returning a base64-encoded PDF? Thanks. EDIT: It looks like HTTP does not support this header. From RFC2616 Section 14 : Note: while the definition of Content-MD5 is exactly the same for HTTP as in RFC 1864 for MIME entity-bodies, there are

Generate HTML e-mail with embedded images in Delphi

岁酱吖の 提交于 2019-11-27 07:04:15
问题 Anyone know of a good example of generating HTML e-mail with embedded images and an alternate text part? I need to generate some tabular reports in HTML and would like to embed logos and other images. I believe Indy can do this with some work, but I was hoping someone could point me to a good example as a starting point. I am open to using libraries other than Indy and commercial solutions provided source is available. Quality and time to implement is more important than cost. The solution

How can I find out a file's MIME type (Content-Type)?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 06:51:21
Is there a way to find out the MIME type (or is it called "Content-Type"?) of a file in a Linux bash script? The reason I need it is because ImageShack appears to need it to upload a file, as for some reason it detects the .png file as an application/octet-stream file. I’ve checked the file, and it really is a PNG image: $ cat /1.png ?PNG (with a heap load of random characters) This gives me the error: $ curl -F "fileupload=@/1.png" http://www.imageshack.us/upload_api.php <links> <error id="wrong_file_type">Wrong file type detected for file 1.png:application/octet-stream</error> </links> This

How can you read a files MIME-type in objective-c

我怕爱的太早我们不能终老 提交于 2019-11-27 06:49:05
I am interested in detecting the MIME-type for a file in the documents directory of my iPhone application. A search through the docs did not provide any answers. slf It's a bit hacky, but it should work, don't know for sure because I'm just guessing at it There are two options: If you just need the MIME type, use the timeoutInterval: NSURLRequest. If you want the data as well, you should use the commented out NSURLRequest. Make sure to perform the request in a thread though, since it's synchronous. NSString* filePath = [[NSBundle mainBundle] pathForResource:@"imagename" ofType:@"jpg"];

Unknown file type MIME?

房东的猫 提交于 2019-11-27 06:42:34
Do I have to specify a MIME type if the uploaded file has no extension? In other words is there a default general MIME type? You can use application/octet-stream for unknown types. RFC 2046 states in section 4.5.1: The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data. RFC resources: We should use RFC-7231 (HTTP/1.1 Semantics and Content) as reference instead of RFC-2046 (Media Types) because question was clearly about HTTP Content-Type. Also RFC-2046 does not clearly define unknown types but RFC-7231 does. Short answer: Do not send MIME type for unknown