I want to put csv file under /wp-content/uploads instead of downloading it . Following php code download this csv file
I am using this php code
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename=data.csv');
$stream = fopen('php://output', 'w+');
fputcsv($stream, $csv_header);
foreach($arrCSV as $key => $assoc_row){
$numeric_row = array();
foreach ($csv_header as $header_name) {
mb_convert_variables('UTF-8', $assoc_row[$header_name]);
$numeric_row[] = $assoc_row[$header_name];
}
fputcsv($stream, $numeric_row);