Log in

View Full Version : Simple, getting errors, please help :)



GITs
11-11-2006, 10:40 AM
OK, I've got to send the contents of a file (LINKPMS.txt) to a set of email addresses stored in another file (uploaders.txt) the email addresses are each on a seperate line and LINKPMS.txt will never be more than one line long.

however, when i try to execute the code below, i get a "Warning: file(uploaders.txt) [function.file]: failed to open stream: No such file or directory in \includes\cron\uploaderemails.php on line 4" and then another error when i try to open LINKPMS.txt on line 14, can someone please help me, this is really bugging me as to what the problem is... I've tried having the file names as "./uploaders.txt" and "./LINKPMS.txt", it made no difference... thanks in advance


<?php
$team_mates="uploaders.txt";
$message="LINKPMS.txt";
$emails=file($team_mates);

for($i=0;$i<count($emails);$i++){
$emails[$i]=trim($emails[$i]);
}

$recipients=implode(",",$emails);


$mail_sub="Auto E-Mail Of Upload Request";
$mail_body=file_get_contents($message);


if($mail_body!="" and $recipients!=""){
if(mail($recipients,$mail_subject,$mail_body,"From: uploadautomailer@l9ianime.com\r\nReply-to: mattcee233@gmail.com")){
$fp=fopen($message);
fwrite($fp,'');
fclose($fp);
}
}
?>

ItsMeOnly
11-11-2006, 12:03 PM
the only thing I can think of is lack of absolute path when you deploy the script (like as a standalone, interpreted by CLI php, or as an include, then ./ path changes from where it resides to where it's run/included from)

GITs
11-11-2006, 12:04 PM
its acting as an include, would it work if i put the url in do you think?

ItsMeOnly
11-11-2006, 12:10 PM
well, I'd just suggest adding "/path/to/the/uploaders.txt" instead of "uploaders.txt",
the same goes for LINKPMS.txt

GITs
11-11-2006, 12:39 PM
worked perfectly, thanks a million times :)