Add functionality to handle import files hosted on server

This commit is contained in:
Gerhard Potgieter 2018-05-24 07:34:40 +02:00
parent 216dce4fab
commit b1739dd21d
1 changed files with 7 additions and 0 deletions

View File

@ -329,6 +329,13 @@ class WC_Product_CSV_Importer_Controller {
}
return ABSPATH . $file_url;
} elseif ( file_exists( $file_url ) ) {
$filetype = wp_check_filetype( $file_url, $valid_filetypes );
if ( ! in_array( $filetype['type'], $valid_filetypes, true ) ) {
return new WP_Error( 'woocommerce_product_csv_importer_upload_file_invalid', __( 'Invalid file type. The importer supports CSV and TXT file formats.', 'woocommerce' ) );
}
return $file_url;
}
// phpcs:enable