I'm using PHP to check if a file exists and then get it's size.
The code worked great before but now that we're using a UNC path I can check that the path exists with file(exists($filename))
but when I try running exec("getsize" . $filename, $out);
it tries to run for about a minute and then it returns that "The system cannot find the file specified". The user running this is currently an admin, otherwise I would think it is a permissions issue, but I'm not sure what else could be the problem if it is finding the file with file_exists() but then the exec() fails.
Any help or points would be greatly appreciated, thank you!
Code example:
<?php
$filename = "\\\\server\\share\\file_path_with_folders\\3019-74 (2).zip"; //Example file
if(file_exists($filename)){
echo "File Exists: " . $filename . "\r\n";
// "File Exists: " . $filename" are getting echoed out, so it is succeeding
} else {
echo "File doesn't exist: " . $filename . "\r\n";
}
exec("getsize" . $filename, $out); //Runs command line command
//Getting "The system cannot find the file specified" error
echo "Out: " . $out[0] . "\r\n";
//Echos "Out: " and nothing else
?>