mail wil not read file attachment

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
catnold
Forum Newbie
Posts: 1
Joined: Wed Apr 04, 2012 8:41 am

mail wil not read file attachment

Post by catnold »

Hi All,

I appreciate any assistance that any may offer. I have a php webmailer that sends email without issue, but when I try to send an attachment, it fails at "if (is_uploaded_file($fileatt))" like the file is not there. I have confirmed that the files are in the correct file location and the file path has been verified with our web host(GoDaddy). This is the section that is failing:

echo " before if satament ";
$fileatt = $_FILES['file']['tmp_name'];
$fileatt_type = $_FILES['file']['type'];
$fileatt_name = $_FILES['file']['name'];
echo $fileatt = "D:\Hosting\\"."2664876\html\uploads\\".$fileatt_name;
echo " Filename: ".$fileatt_name." ";
if (is_uploaded_file($fileatt))
{
echo "Start of the if statement.";
$file = fopen($fileatt, 'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
echo "in if satament";
}
else
{
echo " FAILED TO OPEN THE FILE! ";
}

$data = chunk_split(base64_encode($data));
$notice_text = "This is a multi-part message in MIME format.";

My echo statements are returning the proper information as far as I can tell:

display_errors = on error_reporting = E_ALL & E_NOTICE uploads/compSidebar.htmlThe file compSidebar.html has been uploaded to uploads/compSidebar.html before if satament D:\Hosting\2664876\html\uploads\compSidebar.html Filename: compSidebar.html FAILED TO OPEN THE FILE! This is a multi-part message in MIME format. --==MULTIPART_BOUNDARY_73ba9dd1468fde11a8403328a6c9a556 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --==MULTIPART_BOUNDARY_73ba9dd1468fde11a8403328a6c9a556 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

a

nd, from echoing the message itself, I get the final message boundary for the attachment:

--==MULTIPART_BOUNDARY_73ba9dd1468fde11a8403328a6c9a556 Content-Type: multipart/mixed Content-Type: text/html; name=compSidebar.html Content-Disposition: attachment; filename=compSidebar.html Content-Transfer-Encoding: base64 --==MULTIPART_BOUNDARY_73ba9dd1468fde11a8403328a6c9a556--

Any assistance would be greatly appreciated. I can provide the full code if needed, but it is too big to post here.

Thank you,

Chriss
Post Reply