Click to See Complete Forum and Search --> : attachment error


sidideas
10-24-2005, 06:37 AM
Hello!
i'm trying to create a script in PHP that sends an email with attachment to the user. However, when i open the recipient's email account, i just see a email without the attachment. What could be the problem? The code is below:



<html>
<head>
<title>Mime Example 1</title>
<style type="text/css">
input.submit {
background-color: #ffffe0;
font-weight: bold;
}
</style>
</head>
<body>
<?php

include "MIME.class";
define('TO', 'sidideas@yahoo.com');

// Has there been a form submission? If yes, go on and
// process...
if (is_array($HTTP_POST_VARS)) {

if ($resume != 'none') {
$fname = './'.$resume_name; // make a real filename
// Get the content-type of the uploaded file

if (preg_match("!/x\-.+!i", $resume_type))
$type = OCTET;
else
$type = $resume_type;

$from = sprintf("'%s' <%s>", $name, $email) ;
copy($resume, $fname); //do error checking if need
$mime = new MIME_mail($from, TO, 'Resume', "Please find attached my resume", "Cc: $email");
$mime->fattach($fname, "Resume of $name", $type);
$mime->send_mail();
echo "Dear $name<p>Your resume has been emailed and a copy sent to you<br>";
unlink($resume); // remove the uploaded file
} else {
echo "Dear $name<p>You have not submitted your resume. Please use the browse button to attach it and click send!<br>";
}
}
?>

<form name="upload" action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data">
<table cellpadding=0 cellspacing=0 summary="upload table">
<tr>
<td>Name:</td><td><input name="name" size=30 maxlength=60>
</tr>
<tr>
<td>E-mail:</td><td><input name="email" size=30 maxlength=60>
</tr>
<tr>
<td>Resume:</td><td><input type=file name="resume"></td>
</tr>
<tr>
<td colspan=2 align="right"><input type=submit class='submit' name='action' value='Send'></td>
</tr>
</table>
</form>



Also, i'm getting access errors with the copy() and unlink() functions ??
"Warning: copy(): Unable to access in /users/cap01s/k0100949/public_cgi/mime1.php on line 36"

"Warning: unlink(): Unable to access in /users/cap01s/k0100949/public_cgi/mime1.php on line 41"

Thanks