Why are you doing it that way instead of the way shown on the manpage? The $filename is usable as-is. Don't prefix it with an additional path. It's also already open as a filehandle, and can be used directly unless you've also use stricted. Or use the upload function, as indicated:
$fh = $query->upload('uploaded_file');
while (<$fh>) {
print;
}