Php uploads Excle files

Source: Internet
Author: User
Tags php excel
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.