Is the Upload file type Limited to EXCEL? Solution

Source: Internet
Author: User
Is the Upload file type Limited to EXCEL? Use this if ($ _ FILES ['Excel _ file'] ['type']! = 'Application/vnd. ms-excel ') does not seem to work out the EXCEL version. how can this problem be solved? $ imgtype = strtolower (strrchr ($ _ F) restricts the Upload file type to EXCEL?


Use this if ($ _ FILES ['Excel _ file'] ['type']! = 'Application/vnd. ms-excel ') does not seem to work.


It may be an EXCEL version. how can this problem be solved?




------ Solution --------------------
$ Imgtype = strtolower (strrchr ($ _ FILES ['Excel _ file'] ['name'], "."); // get the extension
If({imagetype}}'.xls '| your imagetype;{'.xlsx') {// Other formats may exist. Add it on your own.
.........
} Else {
.......
}
------ Solution --------------------
The method on the fifth floor is good. I have been using it.
I have studied it before and found that some formats display different MIME types in different browsers... It is even empty.
Determining the suffix is the most direct

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.