我使用php上传功能上传我的界面中的文件。我在浏览器中使用firefox-3.6.11。我正在上传Excel表格。我试图让type.I有以下方法测试的文件类型上传的文件,php中的文件上传
$Type = $HTTP_POST_FILES['TS_FILE']['type'];
$Data = split ("/", $Type,2) ;
if("$Data[1]" != "vnd.ms-excel" && $Data[1]!="octet-stream" && "$Data[1]"!="xls" && "$Data[1]" != "excel")
{
echo "<script> //alert ('inside alert') ;
alert ('The selected file is not in .xls format. Please select proper file.') ;
</script>";
exit;
}
它工作正常。但是有一段时间,即使我上传了Excel表格,我也收到了代码中提到的警告消息。我不知道确切的问题是什么。有没有其他的Excel文件类型可用于Firefox?
也许'var_dump'或$ Data的某些日志会有帮助吗? (它可以是xlsx ???) – kpower 2011-06-08 07:41:46