Cannot open file using fopen (php) -



Cannot open file using fopen (php) -

i trying open file reading in php script having trouble.

this code

$filehandle = fopen("1234_main.csv", "r")or die("unable open"); if (!file_exists($filehandle)) { echo "cannot find file."; }

the script in same directory file trying read , there no other read/write permission errors can create/read other files in same directory.

when run script "cannot find file" error message. why error message beingness shown? certainly if fopen() can't open file "or die statement" should end script?

also, why can't open file when exists , in same location script (i have tried using total path of filename instead of filename).

i new php (but have exp in c++) if stupid question apologize.

many thanks

file_exists() take file-name input, logic of code has problem. first seek open file check existence?

you first should check existence file_exists("1234_main.csv") , if exists seek open it.

php file-io fopen

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -