fopen is not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Amresh.Dash
Forum Newbie
Posts: 1
Joined: Sun May 11, 2008 11:46 pm

fopen is not working

Post by Amresh.Dash »

hello everybody,
Pls go through the code below:-

$myOriginFile = "findchip/findchip_to_replace.html";
$myDestinationFile = "findchip/findchip_category" . rand() . ".html";
if (file_exists($myDestinationFile))
{
unlink($myDestinationFile);
}
$fh = fopen($myOriginFile, "w") or die("can't open file");
fwrite($fh, $myLine1);
fclose($fh);
While executing this code in my localhost its working fine but after hosting it to my web server its not working. The output it showing is - can't open file.
Any suggestions from anybody to get it rectified.
prashantAG
Forum Newbie
Posts: 7
Joined: Wed Apr 30, 2008 1:31 am

Re: fopen is not working

Post by prashantAG »

do the following any one gave u soln
1.check the correct path before hosting, i.e. fopen()
2. in u r code file don't include header(),location("") function.you better to use redirect .
3. gave full path like fopen("c:mydoc\findchip\findchip_to_replace.html")
Post Reply