View Single Post
  #1  
Old 10-26-2011, 05:06 PM
djkfunk is offline djkfunk
Registered User

Join Date: Oct 2011
Posts: 7

HTML Email Notification

Hi, I just installed phUploader 1.3. Looks like a great product so far, and it looks like the support is equally great, so thanks for both.

I'm making some modifications. I need to receive an email when a file(s) are uploaded with a link to the file(s) as well as the name of the file(s) uploaded. I started by adding the code from this post: http://www.novahq.net/forum/showthread.php?t=44866. I then modified it so it's now HTML-based email.

This is what I have - inserted on line 266 right after:

$error.="<b>FAILED:</b> No files selected<br />";
}

(I changed my email for obvious reasons).

PHP Code:
If($success!="") {
$to "MyEmail@MyDomain.com";
$subject "New File Uploaded";

$message "
<html>
<head>
<title>New File Uploaded</title>
</head>
<body>
<p>A new file has been uploaded to the web server.</p>
<p><b>FILE NAME:</b> "
.$file_name[$i]."</p>
<p><b>URL:</b> <a href=\""
.$full_url.$file_name[$i].".".$file_ext[$i]."\" target=\"_blank\">".$full_url.$file_name[$i].".".$file_ext[$i]."</a></p>
</table>
</body>
</html>
"
;

// Always set content-type when sending HTML email
$headers "MIME-Version: 1.0" "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" "\r\n";

// More headers
$headers .= 'From: <noreply@MyDomain.com>' "\r\n";
// $headers .= 'Cc: MyBoss@MyDomain.com' . "\r\n";

mail($to,$subject,$message,$headers);
    } 
My files upload fine, and I receive an HTML email fine, but the file name does not show up (the words "file name" show but not the file name itself) - and the URL is incomplete - it shows the URL up to my Uploads folder and then stops. I'm sure I coded it incorrectly because the 2 parts not working were simply pasted from other areas (I'm a PHP noob). I also tried a PHP echo code for the file name <?php echo $file_name ?> but that didn't work either - I believe because the file name is not defined...(?)

Anyway, sorry if I said way more than I need to, just trying to be thorough...so the big question is, can anyone help? Again, I'd like the file names and URL's to show in the email, and the lines I'm looking for help with are:

HTML Code:
<p><b>FILE NAME:</b> ".$file_name[$i]."</p>
<p><b>URL:</b> <a href=\"".$full_url.$file_name[$i].".".$file_ext[$i]."\" target=\"_blank\">".$full_url.$file_name[$i].".".$file_ext[$i]."</a></p>
Thanks in advance!
Reply With Quote