Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to check the file type of CSV files across *nix-based systems and Windows-based systems.
<?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...
}
<?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
You can’t perform that action at this time.