PHP Excel
To implement PHP upload Excel, when selecting a file, only show Excel file, and how to judge $upfile=$_files["Upfile"]; $type = $upfile ["type"]; $type is Excel, I tried $type== "xls" does not, it should be equal to what, there is a problem is uploading, not all the first upload files to a temporary file, and then move to the specified target, how to delete this temporary file
Reply to discussion (solution)
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, temporary directory without your tube, upload the program after the system will automatically delete temporary files.
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, temporary directory without your tube, upload the program after the system will automatically delete temporary files.
Are these all in excle format, as long as $type= "application/vnd.ms-excel"?
I'm writing this one?
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
}
Judge the extension.