Php uploads Excle files in PHP Excel
To upload an EXCEL file in php, only the EXCEL file is displayed when you select a file, and how to determine $ upfile =$ _ FILES ["upfile"]; $ type = $ upfile ["type"]; $ type is excel. I tried $ type = "xls". what should it be like, another problem is that during the upload, not all files are first uploaded to a temporary file and then moved to the specified target. how can this temporary file be deleted?
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. you do not need to worry about the temporary directory. after the upload program is executed, the system will automatically delete the 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. you do not need to worry about the temporary directory. after the upload program is executed, the system will automatically delete the temporary files.
Are these in excle format, as long as $ type = "application/vnd. ms-excel "?
I wrote this?
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;
}
Determine the extension.