You have done One silly mistake at


$tmpName = $_FILES['userfile']['tmpname'];
here you have written [tmpname] instead if ['tmp_name']
so you should have to write

$tmpName = $_FILES['userfile']['tmp_name'];