I have a basic import tool that we are using to upload into our database using PHP. Here is a sample script. My question is how can I validate the headers before import? Basically check against a value to make sure the right file is getting imported.I looked everywhere online, but can't seem to find the answer My headers are
SKU, Price, Active
LOAD DATA LOW_PRIORITY LOCAL INFILE '$file' INTO TABLE
sample
.your_temp_table
FIELDS TERMINATED BY ' ' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY ' ' IGNORE 1 LINES //Continue to run rest of script
My question is how to validate the headers before the script is ran? I'm using
$file = $_GET['file']; $file = urldecode ($file); //getting file on upload