It is more secure to use CGI.pm's upload() method to create a filehandle and read from that filehandle than to create a filehandle from user-supplied data in a file upload field. Therefore, it is recommended to use the latter code snippet.
Also, you can set the $CGI::POST_MAX and $CGI::DISABLE_UPLOADS to specify the maximum bytesize of a file that can be uploaded and to enable/disable file uploads, respectively. The link above contains information on those variables as well.