Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenDir: Invalid argument (errno 22), HELP????

Status
Not open for further replies.

Naits

Programmer
Oct 10, 2001
90
NO
I am trying to download all .txt files from a folder on my homepage, but i get an error message that says:
Warning: OpenDir: Invalid argument (errno 22) in c:\phpweb\gameuniverse design 2\cheats\pc\dl.php on line 5

Fatal error: Call to a member function on a non-object in c:\phpweb\gameuniverse design 2\cheats\pc\dl.php on line 7

Here is my script:
<?
$filepath = &quot;$local = &quot;c:\\&quot;;

$dir = dir($filepath);

while($f=$dir->read()) {
// if entry is system file (doesn't have picture files), go to next entry in
// &quot;while&quot; loop
if($entry == &quot;.&quot; || $entry == &quot;..&quot;) {
continue;
}
if (substr($f,-4)==&quot;.txt&quot;) {
$fp1 = fopen($f,&quot;r&quot;);
$fp2 = fopen($local,&quot;w+&quot;);
Print(&quot;Opened them...&quot;);
while(!feof($fp1)) {
$line = fread($fp1,1024);
fputs($fp2,$line,strlen($line));
fclose($fp1);
fclose($fp2);
}
}

}
?>

What is wrong?? Do I have to CHMOD the directory?, in case how do i do that(I dont have ftp account)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top