I need just a little help with a adding an attachment to an email via php

Hello what im trying to do is very simple however I guess its just not simple enough for me :stuck_out_tongue:

[SIZE=2]Anyway my problem is I can quite make the attachment part of my flash/PHP emailer work.[/SIZE]

[SIZE=2]All I want to do is attach one file to an email, Basically a persons resume.[/SIZE]

[SIZE=2]I have the email part working I just cant seem to get the attachment to attach and send. The file is going to already be on the server, I used a tutorial to get files uploaded.[/SIZE]
this is my email actionscript:

 
System.useCodepage = true;
send_btn.onRelease = function() {
 my_vars = new LoadVars();
 my_vars.sendername = name_box.text;
 my_vars.sender = email_box.text;
 my_vars.message = message_box.text;
 if (my_vars.sender != "" and my_vars.sendername != "" and my_vars.message != "") {
  my_vars.sendAndLoad("mailer.php", my_vars, "POST");
  gotoAndStop(2);
 } else {
  error_clip.gotoAndPlay(2);
 }
 my_vars.onLoad = function() {
  gotoAndStop(3);
 };
};
email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function () {
 if (error_clip._currentframe != 1) {
  error_clip.gotoAndPlay(6);
 }
};
 

this is my file upload actionscript:

 
//imagePane change to text output
//Allow this domain
System.security.allowDomain("http://localhost/");
import flash.net.FileReference;
// The listener object listens for FileReference events.
var listener:Object = new Object();
// When the user selects a file, the onSelect() method is called, and
// passed a reference to the FileReference object.
listener.onSelect = function(selectedFile:FileReference):Void {
 
  // Flash is attempting to upload the image.
  statusArea.text += "Attempting to upload " + selectedFile.name + "
";
  // Upload the file to the PHP script on the server.
  selectedFile.upload("upload.php");
};
// the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void {
  statusArea.text += "Uploading " + selectedFile.name + "
";
};
//Possible file upload errors
listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
 imagePane.contentPath = "error";
 imagePane.content.errorMSG.text = "HTTPError number: "+httpError +"
File: "+ file.name;
}
listener.onIOError = function(file:FileReference):Void {
 imagePane.contentPath = "error";
 imagePane.content.errorMSG.text = "IOError: "+ file.name;
}
listener.onSecurityError = function(file:FileReference, errorString:String):Void {
 imagePane.contentPath = "error";
 imagePane.content.errorMSG.text = "SecurityError: "+SecurityError+"
File: "+ file.name; 
}
 
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
uploadBtn.onPress = uploadImage;
imagePane.addEventListener("complete", imageDownloaded);
// Call the uploadImage() function, opens a file browser dialog.
function uploadImage(event:Object):Void {
  imageFile.browse([{description: "Text Files", extension: "*.txt;*.rtf;*.doc"}]);
}
// If the filedoes not download, the event object's total property
// will equal -1. In that case, display am error message
function imageDownloaded(event:Object):Void {
  if(event.total == -1) {
    imagePane.contentPath = "error"; 
  }
}
 
function downloadImage(file:Object):Void {
  imagePane.contentPath =  "./files/" + file;
}

here is my upload php:

<?php
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("./files")) mkdir("./files", 0755); 
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
chmod("./files/".$_FILES['Filedata']['name'], 0777);
?>

and here is my email php:

 
<?php
// read the variables from the strings
$sendername = $_REQUEST["sendername"];
$subject = "Resume from website.";
$message = $_REQUEST["message"];
$sender = $_REQUEST["sender"];
// include sender IP in the message and the senders name.
$full_message = "Sender IP: " . $_SERVER['REMOTE_ADDR'] . "

" . "From: " . $sendername . "

" . $message;
$message= $full_message;
 
// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message); 
$sender = stripslashes($sender); 
// send the email
if(isset($message) and isset($subject) and isset($sender)and isset($sendername)){
 mail("myemail@mywebsite.com", $subject, $message, "From: $sender");
}
?>

The upload script puts the file in a folder called files. How do I put the file into the email?

[SIZE=2]At this point the only thing left is getting the file to attach to the email and send it, however I cant figure this out. If anyone could help me I would really appreciate it.[/SIZE]

Thanks