I would like to open the file in PHP, and the first thing I do is check if it exists. Because of this, I add it to the catch try block, so the script does not crash. If the file does not exist, the script should stop. The code below contains an error message the file could not be opened.
(File does not exist for testing)
try
{
$file_handle = fopen("uploads/".$filename."","r");
}
catch (Exception $hi)
{
die("Fehler");
}
This is the error displayed in my browser:
Warning: fopen (uploads / Testdatensatz_Bewerbungenn.csv): could not open stream: There is no such file or directory in [...] \ bewerbungToDB.php on line 11
source
share