json_data.prettynames[columnIds[i]] = columnNames[i]; } json_data.headers = columnIds; initialization(); for(var i = 0, len = variablesToDisplay.length; i < len; i ++) { addElementOnGridBoard(variablesToDisplay[i]); } }) .fail(function() { console.log( "error" ); }); } else { file_name = "<?php if (isset($_POST['pasted_data']) && strlen($_POST['pasted_data']) > 1) { echo write_pasted_data($_POST['pasted_data']); } else { echo ''; } ?> "; if(file_name.length == 0) { file_name = "<?php if (isset($_POST['file_name'])) { echo $_POST['file_name']; } else { echo 'vc-reduced.csv'; } ?> ";
{ $unique_id = uniqid(); $data_file = "./uploads/" . $unique_id . ".csv"; $handle = fopen($data_file, 'w') or die('Cannot open file: ' . $data_file); fwrite($handle, $data_string); fclose($handle); return $unique_id; } if (isset($_POST['json_string']) && isset($_POST['action'])) { $json_string = $_POST['json_string']; $action = $_POST['action']; if ($action == "write_config") { echo write_config_file($json_string); } else { if ($action == "write_pasted_data") { echo write_pasted_data($json_string); } else { if ($action == "write_dataset") { echo write_dataset($json_string); } else { if ($action == "write_csv_dataset") { echo write_csv_dataset($json_string); } else { echo "all your bases are belong to us"; } } } } } else { die('No json string or action provided'); }