PHP Excel
要实现php上传EXCEL时,在选择文件时,只显示EXCEL文件,还有就是如何判断$upfile=$_FILES["upfile"];$type = $upfile["type"]; $type是excel的, 我试过$type=="xls"不行,它应该等于什么,还有一个问题就是上传时,不是都是先把文件上传到一个临时文件,然后在移动到指定目标,这个临时文件怎么删除 1、$upfile["type"]:
xla application/vnd.ms-excel
xlc application/vnd.ms-excel
xll application/x-excel
xlm application/vnd.ms-excel
xls application/vnd.ms-excel
xlt application/vnd.ms-excel
xlw application/vnd.ms-excel
2、临时目录不用你管,上传程序执行完系统会自动删除临时文件。
1、$upfile["type"]:
xla application/vnd.ms-excel
xlc application/vnd.ms-excel
xll application/x-excel
xlm application/vnd.ms-excel
xls application/vnd.ms-excel
xlt application/vnd.ms-excel
xlw application/vnd.ms-excel
2、临时目录不用你管,上传程序执行完系统会自动删除临时文件。
这些都是excle格式的吗,只要$type="application/vnd.ms-excel"这样吗
我是写个这个?
witch ($type) {
case 'xla application/vnd.ms-excel ' : $ok=1;
break;
case 'xlc application/vnd.ms-excel' : $ok=1;
break;
case 'xll application/x-excel ' : $ok=1;
break;
case ' xlm application/vnd.ms-exce' : $ok=1;
break;
case 'xls application/vnd.ms-excel' : $ok=1;
break;
case 'xlt application/vnd.ms-excel' : $ok=1;
break;
case 'xlw application/vnd.ms-excel' : $ok=1;
break;
}
判断扩展名吧