Results 1 to 5 of 5

Thread: Simple, getting errors, please help :)

  1. #1
    Join Date
    Nov 2006
    Location
    UK
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple, getting errors, please help :)

    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 Code:
    <?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);
        }
    }
    ?>

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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)

  3. #3
    Join Date
    Nov 2006
    Location
    UK
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    its acting as an include, would it work if i put the url in do you think?

  4. #4
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well, I'd just suggest adding "/path/to/the/uploaders.txt" instead of "uploaders.txt",
    the same goes for LINKPMS.txt

  5. #5
    Join Date
    Nov 2006
    Location
    UK
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    worked perfectly, thanks a million times

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •