failed to open stream: No such file or directory in

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
B.Murali Krishna
Forum Commoner
Posts: 28
Joined: Fri May 12, 2006 2:05 am
Location: Hyderabad,India
Contact:

failed to open stream: No such file or directory in

Post by B.Murali Krishna »

Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


dear friends,

i have the code 
<?php 

$test=mkdir("$category", 0755);
chmod("$category", 0755);

$file = '../main/cate/poll1.php';
$newfile = "$foldername/$category/index.php";

if (!copy($file, $newfile)) {
   echo "failed to copy $file...\n";
}
chmod("$category/index.php", 0755);
$handle = fopen("$category/index.php", "r+");
$content=file_get_contents($newfile);
//add id to the index file of the folder
$new="<? $";

$new.="id=$pid ; ";
$content="$new".$content;
if (fwrite($handle, $content) === FALSE) {
       echo "Cannot write to file ( ".$filename.")";
       exit;
   }//fwrite
  // }//if not exist
}//while
?>
the erro message is

Code: Select all

Warning: copy(ColoradoStateRamsatAirFor/230267/index.php) [function.copy]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 42
failed to copy ../main/cate/poll1.php...
Warning: chmod() [function.chmod]: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 45

Warning: fopen(230267/index.php) [function.fopen]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 46

Warning: file_get_contents(ColoradoStateRamsatAirFor/230267/index.php) [function.file-get-contents]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 47

Warning: fwrite(): supplied argument is not a valid stream resource in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 53
Cannot write to file ( )

Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by B.Murali Krishna on Fri May 12, 2006 3:42 am, edited 1 time in total.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: failed to open stream: No such file or directory in

Post by jmut »

B.Murali Krishna wrote:dear friends,

i have the code

Code: Select all

$test=mkdir("$category", 0755);
chmod("$category", 0755);

$file = '../main/cate/poll1.php';
$newfile = "$foldername/$category/index.php";

if (!copy($file, $newfile)) {
   echo "failed to copy $file...\n";
}
chmod("$category/index.php", 0755);
$handle = fopen("$category/index.php", "r+");
$content=file_get_contents($newfile);
//add id to the index file of the folder
$new="<? $";

$new.="id=$pid ; ";
$content="$new".$content;
if (fwrite($handle, $content) === FALSE) {
       echo "Cannot write to file ( ".$filename.")";
       exit;
   }//fwrite
  // }//if not exist
}//while
the erro message is

Warning: copy(ColoradoStateRamsatAirFor/230267/index.php) [function.copy]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 42
failed to copy ../main/cate/poll1.php...
Warning: chmod() [function.chmod]: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 45

Warning: fopen(230267/index.php) [function.fopen]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 46

Warning: file_get_contents(ColoradoStateRamsatAirFor/230267/index.php) [function.file-get-contents]: failed to open stream: No such file or directory in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 47

Warning: fwrite(): supplied argument is not a valid stream resource in c:\wamp\www\showtickets\coloradostateramsatairfor\index.php on line 53
Cannot write to file ( )
does'nt look like you validate each function. is mkdir actually creating the dir!. use php tags. it is pretty hard to read. user error_reporting(E_ALL)
Post Reply