Created
November 11, 2013 14:10
-
-
Save tommcfarlin/5e9eea5dfa788cd1c52b to your computer and use it in GitHub Desktop.
How to check the file type of CSV files across *nix-based systems and Windows-based systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Read the file from the $_FILES collection | |
$file = $_FILES['re_csv_file']; | |
// Check the type of the file to make sure it's a CSV (*nix-based systems, Windows-based systems) | |
if( 'text/csv' == $file['type'] || 'application/vnd.ms-excel' == $file['type'] ) { | |
// Parse the CSV... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Read the file from the $_FILES collection | |
$file = $_FILES['re_csv_file']; | |
// Check the type of the file to make sure it's a CSV | |
if( 'text/csv' == $file['type'] ) { | |
// Parse the CSV... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment