Hi
I am new to PHP. I am trying to open a file using "fopen", but its not working. following is the code I am using:
<html>
<?php
$filename = 'chees.doc';
$fp = fopen($filename, "r");
if(!$fp) {
echo "Cannot open file ($filename)";
return -1;
}
echo "Opened file ($filename)";
fclose ($fp);
?>
</html>
This works when run from local machine. but when its uploaded on the web site, it says "Cannot open file (chees.doc)".
This is such a simple code, but I do not understand what's wrong.
Thanks,
I am new to PHP. I am trying to open a file using "fopen", but its not working. following is the code I am using:
<html>
<?php
$filename = 'chees.doc';
$fp = fopen($filename, "r");
if(!$fp) {
echo "Cannot open file ($filename)";
return -1;
}
echo "Opened file ($filename)";
fclose ($fp);
?>
</html>
This works when run from local machine. but when its uploaded on the web site, it says "Cannot open file (chees.doc)".
This is such a simple code, but I do not understand what's wrong.
Thanks,