我用apache+PHP建了个wap网站,做wap软件下载,基本上都是jar sis cab sisx rar zip文件格式。我在mimi.type文件里增加了这些东西:
application/vnd.smartpohone cab
text/vnd.sun.j2me.app-descriptor jad
application/java-archive jar
sisx x-epoc/x-sisx-app sisx
application/vnd.symbian.install sis
在http.conf的<IfModule mime_module>下面添加了这些:
AddType application/octet-stream .jar
AddType application/octet-stream .sis
AddType application/octet-stream .sisx
AddType application/octet-stream .cab
AddType application/octet-stream .jad
AddType application/octet-stream .rar
AddType application/octet-stream .zip我用手机测试文件下载的时候出现问题就是下载的文件都没有扩展名,比如1.sis 下载提示保存的时候是1(没有扩展名) 保存好了看属性是1.EXT 我真不知道是什么原因。 无论下载什么格式的都是 文件名.EXT。可是我用opera(电脑上的opera,可以访问wap站)测试下载是可以的。文件名跟扩展名都有。说明一下我的wap下载站在虚拟目录,请问服务器配置高手这种问题该如何解决?
我是菜鸟不明白。
application/vnd.smartpohone cab
text/vnd.sun.j2me.app-descriptor jad
application/java-archive jar
sisx x-epoc/x-sisx-app sisx
application/vnd.symbian.install sis
在http.conf的<IfModule mime_module>下面添加了这些:
AddType application/octet-stream .jar
AddType application/octet-stream .sis
AddType application/octet-stream .sisx
AddType application/octet-stream .cab
AddType application/octet-stream .jad
AddType application/octet-stream .rar
AddType application/octet-stream .zip我用手机测试文件下载的时候出现问题就是下载的文件都没有扩展名,比如1.sis 下载提示保存的时候是1(没有扩展名) 保存好了看属性是1.EXT 我真不知道是什么原因。 无论下载什么格式的都是 文件名.EXT。可是我用opera(电脑上的opera,可以访问wap站)测试下载是可以的。文件名跟扩展名都有。说明一下我的wap下载站在虚拟目录,请问服务器配置高手这种问题该如何解决?
我是菜鸟不明白。
解决方案 »
- 缩略图的问题,麻烦知道的帮我下,急!!!!!!!!!
- curl批量获取远程数据出现不稳定的情况
- 求高手给我解决一下我不知道哪里错了!明明是正确的啊
- 请教一下,我想在每天零点自动运行一条命令,怎么办呢?
- 怎么按照规则把这个数组 array_merge
- 如何设计?处理长度千位以上数值的加减乘除运算
- 怎样制作客户调查反馈表?分不够再加
- 如何用mysql指令将数据库文本文件转换成.frm,.myd,.myi 库文件
- 超急~~有关pear的问题~~
- 图片在不同的手机屏幕尺寸下变形了,这该怎么弄?大神们!
- 求救,我自己的php程序写入中文乱码,phpmyadmin写入中文正常,我那里错了
- 学习PHP到了中期,有些迷惑
你应该看看手机官方的开发文档,
用手机虚拟器测试一下,
看看用虚拟器下载的时候,HTTP通信的状况。
http://www.music027.cn/rosean/read.php?299
到这里找下你的手机文件类型如:
.sis| application/vnd.symbian.install.sisx|x-epoc/x-sisx-app
这是程序的问题,和服务器无关
这个和服务器 、PHP 都不相关,主要是头信息的问题。另外要添加
application/vnd.smartpohone cab
text/vnd.sun.j2me.app-descriptor jad
application/java-archive jar
sisx x-epoc/x-sisx-app sisx
application/vnd.symbian.install sis 到 function setfiletype()函数里边
下载类如下:<?
//====================================================
// FileName:download.class.php
// Summary: 文件下载类
// Author: feifengxlq
// Email:[email protected]
// CreateTime: 2005-7-19
// LastModifed:
// copyright (c)2005 xlq.100steps.net [email protected]
// 使用范例:
// $download=new download('php,exe,html',false);
// if(!$download->downloadfile($filename))
// {
// echo $download->geterrormsg();
// }
//====================================================
class download{
var $debug=true;
var $errormsg='';
var $Filter=array();
var $filename='';
var $mineType='';
var $xlq_filetype=array(); function download($fileFilter='',$isdebug=true)
{
$this->setFilter($fileFilter);
$this->setdebug($isdebug);
$this->setfiletype();
} function setFilter($fileFilter)
{
if(empty($fileFilter)) return ;
$this->Filter=explode('.',strtolower($fileFilter));
}
function setdebug($debug)
{
$this->debug=$debug;
} function setfilename($filename)
{
$this->filename=$filename;
} function downloadfile($filename)
{
$this->setfilename($filename);
if($this->filecheck())
{
ini_set('memory_limit', '-1');
$fn = array_pop( explode( '/', strtr( $this->filename, '\\', '/' ) ) );
header( "Pragma: public" );
header( "Expires: 0" ); // set expiration time
header( "Cache-Component: must-revalidate, post-check=0, pre-check=0" );
header('Content-Encoding: none');
header( "Content-type:".$this->mineType );
header( "Content-Length: " . filesize( $this->filename ) );
header( "Content-Disposition: attachment; filename=\"$fn\"" );
header( 'Content-Transfer-Encoding: binary' );
ob_clean();
flush();
readfile( $this->filename );
return true;
}else
{
return false;
}
}
function geterrormsg()
{
return $this->errormsg;
} function filecheck()
{
$filename=$this->filename;
if(file_exists($filename))
{
$filetype=strtolower(array_pop(explode('.',$filename)));
if(in_array($filetype,$this->Filter))
{
$this->errormsg.=$filename.'不允许下载!';
if($this->debug) exit($filename.'不允许下载!') ;
return false;
}else
{
if ( function_exists( "mime_content_type" ) )
{
$this->mineType = mime_content_type( $filename );
}
if(empty($this->mineType))
{
if( isset($this->xlq_filetype[$filetype]) ) $this->mineType = $this->xlq_filetype[$filetype];
}
if(!empty($this->mineType))
return true;
else
{
$this->errormsg.='获取'.$filename.'文件类型时候发生错误,或者不存在预定文件类型内';
if($this->debug) exit('获取文件类型出错');
return false;
}
}
}else
{
$this->errormsg.=$filename.'不存在!';
if($this->debug) exit($filename.'不存在!') ;
return false;
}
} function setfiletype()
{
$this->xlq_filetype['chm']='application/octet-stream';
$this->xlq_filetype['ppt']='application/vnd.ms-powerpoint';
$this->xlq_filetype['xls']='application/vnd.ms-excel';
$this->xlq_filetype['doc']='application/vnd.ms-word';
$this->xlq_filetype['exe']='application/octet-stream';
$this->xlq_filetype['rar']='application/octet-stream';
$this->xlq_filetype['js']="javascript/js";
$this->xlq_filetype['css']="text/css";
$this->xlq_filetype['hqx']="application/mac-binhex40";
$this->xlq_filetype['bin']="application/octet-stream";
$this->xlq_filetype['oda']="application/oda";
$this->xlq_filetype['pdf']="application/pdf";
$this->xlq_filetype['ai']="application/postsrcipt";
$this->xlq_filetype['eps']="application/postsrcipt";
$this->xlq_filetype['es']="application/postsrcipt";
$this->xlq_filetype['rtf']="application/rtf";
$this->xlq_filetype['mif']="application/x-mif";
$this->xlq_filetype['csh']="application/x-csh";
$this->xlq_filetype['dvi']="application/x-dvi";
$this->xlq_filetype['hdf']="application/x-hdf";
$this->xlq_filetype['nc']="application/x-netcdf";
$this->xlq_filetype['cdf']="application/x-netcdf";
$this->xlq_filetype['latex']="application/x-latex";
$this->xlq_filetype['ts']="application/x-troll-ts";
$this->xlq_filetype['src']="application/x-wais-source";
$this->xlq_filetype['zip']="application/zip";
$this->xlq_filetype['bcpio']="application/x-bcpio";
$this->xlq_filetype['cpio']="application/x-cpio";
$this->xlq_filetype['gtar']="application/x-gtar";
$this->xlq_filetype['shar']="application/x-shar";
$this->xlq_filetype['sv4cpio']="application/x-sv4cpio";
$this->xlq_filetype['sv4crc']="application/x-sv4crc";
$this->xlq_filetype['tar']="application/x-tar";
$this->xlq_filetype['ustar']="application/x-ustar";
$this->xlq_filetype['man']="application/x-troff-man";
$this->xlq_filetype['sh']="application/x-sh";
$this->xlq_filetype['tcl']="application/x-tcl";
$this->xlq_filetype['tex']="application/x-tex";
$this->xlq_filetype['texi']="application/x-texinfo";
$this->xlq_filetype['texinfo']="application/x-texinfo";
$this->xlq_filetype['t']="application/x-troff";
$this->xlq_filetype['tr']="application/x-troff";
$this->xlq_filetype['roff']="application/x-troff";
$this->xlq_filetype['shar']="application/x-shar";
$this->xlq_filetype['me']="application/x-troll-me";
$this->xlq_filetype['ts']="application/x-troll-ts";
$this->xlq_filetype['gif']="image/gif";
$this->xlq_filetype['jpeg']="image/pjpeg";
$this->xlq_filetype['jpg']="image/pjpeg";
$this->xlq_filetype['jpe']="image/pjpeg";
$this->xlq_filetype['ras']="image/x-cmu-raster";
$this->xlq_filetype['pbm']="image/x-portable-bitmap";
$this->xlq_filetype['ppm']="image/x-portable-pixmap";
$this->xlq_filetype['xbm']="image/x-xbitmap";
$this->xlq_filetype['xwd']="image/x-xwindowdump";
$this->xlq_filetype['ief']="image/ief";
$this->xlq_filetype['tif']="image/tiff";
$this->xlq_filetype['tiff']="image/tiff";
$this->xlq_filetype['pnm']="image/x-portable-anymap";
$this->xlq_filetype['pgm']="image/x-portable-graymap";
$this->xlq_filetype['rgb']="image/x-rgb";
$this->xlq_filetype['xpm']="image/x-xpixmap";
$this->xlq_filetype['txt']="text/plain";
$this->xlq_filetype['c']="text/plain";
$this->xlq_filetype['cc']="text/plain";
$this->xlq_filetype['h']="text/plain";
$this->xlq_filetype['html']="text/html";
$this->xlq_filetype['htm']="text/html";
$this->xlq_filetype['htl']="text/html";
$this->xlq_filetype['rtx']="text/richtext";
$this->xlq_filetype['etx']="text/x-setext";
$this->xlq_filetype['tsv']="text/tab-separated-values";
$this->xlq_filetype['mpeg']="video/mpeg";
$this->xlq_filetype['mpg']="video/mpeg";
$this->xlq_filetype['mpe']="video/mpeg";
$this->xlq_filetype['avi']="video/x-msvideo";
$this->xlq_filetype['qt']="video/quicktime";
$this->xlq_filetype['mov']="video/quicktime";
$this->xlq_filetype['moov']="video/quicktime";
$this->xlq_filetype['movie']="video/x-sgi-movie";
$this->xlq_filetype['au']="audio/basic";
$this->xlq_filetype['snd']="audio/basic";
$this->xlq_filetype['wav']="audio/x-wav";
$this->xlq_filetype['aif']="audio/x-aiff";
$this->xlq_filetype['aiff']="audio/x-aiff";
$this->xlq_filetype['aifc']="audio/x-aiff";
$this->xlq_filetype['swf']="application/x-shockwave-flash";
}
}
?>