我使用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