mime

Stop IE8 from opening or downloading a text/plain MIME type

感情迁移 提交于 2019-12-03 21:29:51
I'm dynamically generating a text file in PHP, so it has a .php extension but a text/plain MIME type. All browsers display the file as nicely preformatted text, except IE8. Googling tells me that they've added security where if the HTTP header content type doesn't match the expected content type (I think based on the extension and some sniffing) then it forces the file to be downloaded. In my case I have to open it, and also give it permission to open the file I just told it open! That's probably a Win7 annoyance though. Serving a static plain text file works fine, of course. So can I stop IE8

Convert embedded pictures in database

不打扰是莪最后的温柔 提交于 2019-12-03 16:47:42
I have a 'small' problem. In a database documents contain a richtextfield. The richtextfield contains a profile picture of a certain contact. The problem is that this content is not saved as mime and therefore I can not calculate the url of the image. I'm using a pojo to retrieve data from the person profile and use this in my xpage control to display its contents. I need to build a convert agent which takes the content of the richtextitem and converts it to mime to be able to calculate the url something like http://host/database.nsf/($users)/D40FE4181F2B86CCC12579AB0047BD22/Photo/M2

Apache 2.4 set mime type of file without extension

≯℡__Kan透↙ 提交于 2019-12-03 16:40:24
问题 I have upgraded from Apache 2.2 to 2.4 on a RedHat 6.4 server and came across an issue with mime types. Apache has a DefaultType Directive. In Apache 2.2 I set this to "text/plain". I have a webpage that lists all files in a given directory and the user can click to view the files. This directory contains all types of different file extensions and some files with no extensions. When a file was clicked, it would open up in a new window nicely formatted. There is not any code doing this. It is

What is the MIME type for TTF files?

二次信任 提交于 2019-12-03 14:26:12
问题 I can't find correct MIME type for TrueType fonts. I need it because I'm using File Uploading Class (CodeIgniter) to upload files, and I want to allow only TTF to be uploaded. Tried this: 'ttf' => 'font/ttf' 'ttf' => 'font/truetype' With no success. Any ideas ? 回答1: TTF does not have a MIME type assigned. You'll have to use the more general application/octet-stream , which is used to indicate binary data with no assigned MIME type. 回答2: I've seen font/ttf and application/x-font-ttf used as

How can I save email attachments to the server in PHP?

陌路散爱 提交于 2019-12-03 13:31:46
问题 I've been battling PHP's email reading functions for the better part of two days. I'm writing a script to read emails from a mailbox and save any attachments onto the server. If you've ever done something similar, you might understand my pain: PHP doesn't play well with email! I've connected to the POP3 server and I can iterate the files. Here's a rough outline of the code: if (!$mbox = imap_open ("{myserver.com:110/pop3/notls}INBOX", "u", "p")) die ('Cannot connect/check mail! Exiting'); if

Is there a way to have a Codeigniter controller return an image?

梦想与她 提交于 2019-12-03 12:04:30
I was wondering if there was a way for a controller to, instead of returning a string, or a view, return an image (be it JPG, PNG etc). For example, instead of ending with a $this->load->view('folder/special_view.php), I'd like to do something like $this->load->image('images/gorilla.png'), and have it so if my user were to go to that controller they would see an image as if they'd gone to a normal .png or jpeg. Can I set the headers so it expects a different MIME? Example code of this would be fantastic. It would take forever for me to explain why I need this, but it involves bringing a

In Rails 3, respond_to and format.all works differently than Rails 2?

喜欢而已 提交于 2019-12-03 10:52:07
问题 the code respond_to do |format| format.html format.json { render :json => @switches } format.xml { render :xml => @switches.to_xml } format.all { render :text => "only HTML, XML, and JSON format are supported at the moment." } end the above will work in Rails 2.2.2. But in Rails 3, getting controller/index.html or index on the browser will both fall into the last line: "only HTML and JSON format are supported at the moment." The only Rails doc I can find on this is http://api.rubyonrails.org

dot(.)s are missing here & there in the mail html while sending PEAR Mail_Mime emails

白昼怎懂夜的黑 提交于 2019-12-03 10:51:02
I am sending a mail using PEAR's mail and mail_mime packages and sample code as below: $sendStart=array(); require_once('Mail.php'); require_once('Mail/mime.php'); $sendStart['mail'] =& Mail::factory('mail'); $sendStart['mime'] = new Mail_mime("\n"); $sendStart['mime']->setHTMLBody($html); $sendStart['headers']['Subject']=$title; $sendStart['headers']['X-SMTPAPI']='{"category": ["MailID-XXX"]}'; $body=$sendStart['mime']->get(array( 'html_charset'=>'UTF-8', 'text_charset'=>'UTF-8', 'head_charset'=>'UTF-8' )); //echo ($sendStart['mime']->_htmlbody); exit; $sendStart['mail']->send('xxx@example

How to let asynchronous readFile method follow order in node.js

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a code like this var fs = require ( 'fs' ); console . log ( "1" ); fs . readFile ( "./index.js" , function ( err , data ) { if ( err ) { console . log ( "err" ); } console . log ( "2" ); }); console . log ( "3" ); and the result will be 1 3 2 But I want 1 2 3 I have look through filesystem's document and it says With the asynchronous methods there is no guaranteed ordering. so the document says if I want my code result 1 2 3 it should be var fs = require ( 'fs' ); console . log ( "1" ); fs . readFile ( "./index.js" ,