Automattic\WooCommerce\Internal\Admin\ImportExport
CSVUploadHelper::remove_txt_from_uploaded_file
wp_import_handle_upload() .txt to any file name. This function is hooked onto wp_handle_upload_prefilter remove those extra characters.
Method of the class: CSVUploadHelper{}
No Hooks.
Returns
Array. Modified file details.
Usage
$CSVUploadHelper = new CSVUploadHelper(); $CSVUploadHelper->remove_txt_from_uploaded_file( $file ): array;
- $file(array) (required)
- File details in the form of a
$_FILESentry.
CSVUploadHelper::remove_txt_from_uploaded_file() CSVUploadHelper::remove txt from uploaded file code WC 10.8.1
public function remove_txt_from_uploaded_file( array $file ): array {
$file['name'] = substr( $file['name'], 0, -4 );
return $file;
}