I am new to Freebsd/nginx, so similar QAs did not help me ;( I was running a code:
$ext = pathinfo ($_FILES[\'rawexcel\'][\'name\'][$i], PATHINFO_EXTENSION);
//
See how you extracted the extension...
$ext = pathinfo ($_FILES['rawexcel']['name'][$i], PATHINFO_EXTENSION);
You can check the pathinfo docs and you'll see how to get the filename without path or extension:
$filename = pathinfo($_FILES['rawexcel']['names'][$i], PATHINFO_FILENAME);
Then you can use that...
if ($ext == 'xlsx' ) {
exec("/usr/local/bin/cnvt /var/tmp/xls/$filename.xlsx /var/tmp/$filename.csv ");
} else if ($ext == 'xls' ) {
exec("/usr/local/bin/xls2csv -x /var/tmp/xls/$filename.xls -b WINDOWS-1251 -c /var/tmp/$filename.csv -a UTF-8");
}