It's up to you where you put the file. And you really need to read CGI.pm docs!
"$q->param('upfile');" gives you the file name on the remote PC. What you need is "$q->upload();", which returns an open file handle to a local copy of the uploaded file. You can then binmode() and read() using that file handle.