Check that the file exists before trying to stat it for filesize

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-03-06 10:47:28 -08:00
parent 3a1cf26e98
commit cc7325074e

View file

@ -126,7 +126,12 @@ class ImportController extends Controller
}
$file_name = date('Y-m-d-his').'-'.$fixed_filename;
$import->file_path = $file_name;
$import->filesize = null;
if (file_exists($path.'/'.$file_name)) {
$import->filesize = filesize($path.'/'.$file_name);
}
$import->save();
$results[] = $import;
}