|
Checking the ext is pointless as I can rename any file.csv, at least test that the file is text not binary, and cleanse it.
A quick fix method would be write a loop to check the data.
Read one line at a time, ignore empty lines.
Explode that data into an array, trim the array elements for white space, as a space will still fill an element.
Test each element, to make sure 0-3 exist, then loop to the next line.
Write The results either to the database or to a file.
This isnt a nice way of doing it and I can think of 2-3 ways to check it, my regex sucks ass, but you could just regex each line to make sure it looks like it should, and discard code that doesnt look right, which is nicest code method, but you'd need someone good with regex.
__________________
Browse:
|