mime

.mp3 Filetype Upload

早过忘川 提交于 2019-12-01 01:24:29
I'm working on a PHP upload script which allows .mp3 file uploads amongst others. I've created an array which specifies permitted filetypes, including mp3s, and set a maximum upload limit of 500MB: // define a constant for the maximum upload size define ('MAX_FILE_SIZE', 5120000); // create an array of permitted MIME types $permitted = array('application/msword', 'application/pdf', 'text/plain', 'text/rtf', 'image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/tiff', 'application/zip', 'audio/mpeg', 'audio/mpeg3', 'audio/x-mpeg-3', 'video/mpeg', 'video/mp4', 'video/quicktime', 'video/x

“missing word in phrase: charset not supported”, when using the mail package

走远了吗. 提交于 2019-12-01 00:52:47
I'm trying to parse emails and I get this kind of errors using the mail package. Is it a bug on the mail package or something I should handle myself ? missing word in phrase: charset not supported: "gb18030" charset not supported: "koi8-r" missing word in phrase: charset not supported: "ks_c_5601-1987" How can I fix them ? I think I should use charset but I'm not sure how . Here's how an email header looks like Received: from smtpbg303.qq.com ([184.105.206.26]) by mx-ha.gmx.net (mxgmxus001) with ESMTPS (Nemesis) id 0MAOx2-1X2yNC2ZFC-00BaVU for <sormester@lobbyist.com>; Sat, 14 Jun 2014 18:11

Get MIME Type via PHP

谁都会走 提交于 2019-12-01 00:43:22
I have local access to files, which I need to get their MIME types. Working in WAMP/LAMP, CodeIgniter, and Zend libraries. What's the best way to get MIME type information? There's no easy way. You could try: http://www.php.net/manual/en/function.finfo-file.php // return mime type ala mimetype extension $finfo = finfo_open(FILEINFO_MIME_TYPE); Of course, this assumes you can install PECL extensions. I think you need head. Quickest way is to do a head request, or in PHP under apache you can use apache_lookup_uri or in PHP 5.3 you can use FileInfo (I'd still recommend apache_lookup_uri or a

Why doesn't this mail message decode correctly?

試著忘記壹切 提交于 2019-12-01 00:11:52
I have this code. It's from the Zend Reading Mail example. $message = $mail->getMessage(1); // output first text/plain part $foundPart = null; foreach (new RecursiveIteratorIterator($mail->getMessage(1)) as $part) { try { if (strtok($part->contentType, ';') == 'text/plain') { $foundPart = $part; break; } } catch (Zend_Mail_Exception $e) { // ignore } } if (!$foundPart) { echo 'no plain text part found'; } else { echo $foundPart->getContent(); } What I can get is the message, that works fine. But trying to decode the message into something readable does not work. I have tried Zend_Mime, imap

Handling MIME type that is the result of a browser POST in Android

本小妞迷上赌 提交于 2019-11-30 21:22:56
问题 I have an Activity that is successfully invoked for the MIME type in which I'm interested. The content being sent from the server is an XML document created as the result of a POST. I've tried to process the result two different ways and I'm not having luck with either: android:mimeType="application/customapp" Doing this, my activity runs, but the URI I get from Intent.getData() is the URL used for the post. A call to getContentResolver().openInputStream() results in java.io

ATTnnnnn.txt attachments when e-mail is received in Outlook

我怕爱的太早我们不能终老 提交于 2019-11-30 19:59:58
I've written an SMTP client that sends e-mails with attachments. Everything's fine except that when an e-mail sent by my program is received by Outlook it displays two attachments - the file actually sent and a file with two characters CR and LF inside and this file has name ATT?????.txt. I've done search - found a lot of matches like this for similar problems and checked everything I could. Even more - I compared two emails - sent by my program and sent by Opera and I can't deduce the difference. However what Opera sends is interpreted correctly, but what my program sends is not. What my

Get MIME Type via PHP

蓝咒 提交于 2019-11-30 19:42:12
问题 I have local access to files, which I need to get their MIME types. Working in WAMP/LAMP, CodeIgniter, and Zend libraries. What's the best way to get MIME type information? 回答1: There's no easy way. You could try: http://www.php.net/manual/en/function.finfo-file.php // return mime type ala mimetype extension $finfo = finfo_open(FILEINFO_MIME_TYPE); Of course, this assumes you can install PECL extensions. 回答2: I think you need head. Quickest way is to do a head request, or in PHP under apache

“missing word in phrase: charset not supported”, when using the mail package

可紊 提交于 2019-11-30 19:01:56
问题 I'm trying to parse emails and I get this kind of errors using the mail package. Is it a bug on the mail package or something I should handle myself ? missing word in phrase: charset not supported: "gb18030" charset not supported: "koi8-r" missing word in phrase: charset not supported: "ks_c_5601-1987" How can I fix them ? I think I should use charset but I'm not sure how . Here's how an email header looks like Received: from smtpbg303.qq.com ([184.105.206.26]) by mx-ha.gmx.net (mxgmxus001)

[笔记] C# 如何获取文件的 MIME Type

爷,独闯天下 提交于 2019-11-30 18:47:14
MIME Type 为何物: MIME 参考手册 svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types 常规方式 对于有文件后缀名的,可以使用 MimeMapping.GetMimeMapping 获取。 MimeMapping.GetMimeMapping(String) Method (System.Web) | Microsoft Docs 如果 MimeMapping.GetMimeMapping 不认识的,会返回 application/octet-stream 这个默认值。 其它方式 对于特定的类型的文件,可以使用与之相关的其它方式获取,如 Image ,可以这样获取: public bool TryBuildFileMimeType(string filePath, out string mimeType) { if (string.IsNullOrWhiteSpace(filePath) || !System.IO.File.Exists(filePath)) { mimeType = string.Empty; return false; } try { var image = Image.FromFile(filePath); mimeType = GetMimeTypeFromImage

Retrieve MIME type from Base64 encoded String

偶尔善良 提交于 2019-11-30 17:26:53
问题 Let' say a file (e.g. myfile.jpeg) encoded in Base64 String and given to me. There is no way I know what the file type was. I'd like to decode the string into a file (an image in this example). How do I know the type of the file (e.g jpeg)? 回答1: In general, a base 64-encoded string could contain absolutely any data, so there is no way to know its file type. To determine if it is an instance of a JPEG image, you'd need to base64-decode it, and then do something like checking its magic number,