Do you have some sort of script that automatically calls mysqlimport or some other means of importing the delimited file into the database automatically? If so, can you paste some code? If not, can you share with us your procedure or just change the password or permission for that user?
fgetcsv() is not sophisticated enough to do error checking. By looking at your code, you might get away with checking to see if $data[0], $data[1], $data[2] are existent and throwing away the file if one of them isn't. However, this will not work if there are null values for ANY of these.
If it were me, I'd go the easy route and put the file inside a password protected directory where only "trusted" users can access.
In my case the file itself inside the protected directory(admin only).
Are you saying that there is no other way to filter it
or there is other safe way to upload csv file?
Thanks for the info.
In the case that we're working with a live database and a corrupted file was uploaded... that'd be tragic. I wouldn't have approached it with an automated system. But rather, I'd make a 'dormant' sister of the database, manually import it in there to make sure everything works before I update the live db. It's a bit more time consuming, but it's a small price to pay.
Oh yeah, I guess it wouldn't hurt to keep a daily dump backup of everything either
Bookmarks