Connecting Tech Pros Worldwide Help | Site Map

Download from remote server to mine. Worked but now doesn't.

Newbie
 
Join Date: Nov 2007
Posts: 30
#1: Jan 16 '08
My script is below. And it worked perfectly until this morning when i got up and went of to try it it didnt work anymore. The code stayed the same so im sure its not that. I think it has something to do with limits on cache or a temporary folder or some other type of limit that my host might have put on without me knowing.

The file goes through the download with out error but when it finally outputs the link and you click on it you get a 404 not found. Through FTP i look and its not there so for some reason it seems that after it downloads it, it doesn't transfer it over to the specified folder. I have checked the CHMODs on everything and just for testing put EVERYTHING at 777.

Can anyone think of something I can try to fix this situation?

[PHP]$link="http://$url";
if($filename=="") { return"link crippled. please check!"; }
if(eregi(".php",$filename)) { $filename="$filename.txt"; }
if(file_exists("files/files$tiam/$filename")) { } else {
echo"Downloading $filename<br><span id=info></span><br>";
$begtime=time();$filex=fopen("$link", "r");
$clog=fopen("files/files$tiam/$filename","a");
if (!$filex) { return "<p>Unable to open remote file. abnormal error. <br><br>"; }


while (!feof ($filex)) {$line = fread ($filex,1024);fwrite($clog,"$line");
$kbf=$kbf+1; $kbx=$kbx+1;if($kbx==100) {
$kbx=0;$nowtime=time();$dura=$nowtime-$begtime+1;$kbs=round($kbf/$dura);
echo"<script>document.getElementById(\"info\").inn erHTML = '<b>$kbf KB @ $kbs KB/s</b>';</script>";}}
fclose($filex);
$tiamx=$tiam;
fclose($clog);mkdir("tmp/$_SERVER[REMOTE_ADDR].$filename",0777);}
$tiam=time();$tiam=substr($tiam,0,7);$tiam=md5($ti am);
rename("files/files$tiamx","files/files$tiam");
return"fetched <b><a href=\"files/files$tiam/$filename\">$filename</a></b>.
click <b><a href=\"files/files$tiam/$filename\">here</a></b> to download it.
<br><br>";[/PHP]
Reply