I have a form where there are three methods of inputing the same type of data depending which method is easier for the user.
I need to check first to see if a file has been uploaded, then if not run through processing the data from the other two inout types.
From a security and good/safe practices standpoint I'm curious if my code is acceptable or if I should be going about this another way:
Is using: if ($_FILES['userfile']['size'] > 0) the best way to catch if a file has been uploaded? Using that works for me, but I want to know if I should be checking something else instead.
if ($_FILES['userfile']['size'] > 0) {
// ...process data if it's coming from an uploaded csv...
add_data(...); // calls function to do the mysql insert
exit();
}
if ($_POST['ftdna']) {
// ...processes data if it comes from cut and paste into a textarea box...
} else {
// ...processes data if it comes from the drop down boxes...
}
add_data(...); // calls function to do the mysql insert