WC_Product_CSV_Importer_Controller::is_file_valid_csv( string $file, bool $check_path = true )
Check whether a file is a valid CSV file.
Description Description
Parameters Parameters
- $file
-
(Required) File path.
- $check_path
-
(Optional) Whether to also check the file is located in a valid location (Default: true).
Default value: true
Return Return
(bool)
Source Source
File: includes/admin/importers/class-wc-product-csv-importer-controller.php
public static function is_file_valid_csv( $file, $check_path = true ) { if ( $check_path && apply_filters( 'woocommerce_product_csv_importer_check_import_file_path', true ) && false !== stripos( $file, '://' ) ) { return false; } $valid_filetypes = self::get_valid_csv_filetypes(); $filetype = wp_check_filetype( $file, $valid_filetypes ); if ( in_array( $filetype['type'], $valid_filetypes, true ) ) { return true; } return false; }