Link to home
Start Free TrialLog in
Avatar of Justin Malone
Justin Malone

asked on

how do i get a form to upload a file to be attached to an e-mail

i have a pre-bult form that can be filled out and submited. when it get submited it sends a text e-mail with the information of all the fields in it. i want users to be able to upload a .doc file that gets attached to the e-mail that gets sent out. im pretty sure i have the code for it i just dont know how to set it up. this is part of whats in my formmail.php file

// check for a file if there is a file upload it

if ($file_name) {

   if ($file_size > 0) {

      if (!ereg("/$", $path_to_file))

         $path_to_file = $path_to_file."/";

      $location = $path_to_file.$file_name;

      if (file_exists($path_to_file.$file_name))

         $location .= ".new";

      copy($file,$location);

      unlink($file);

      $content .= "Uploaded File: ".$location."\n";

   }

}

ASKER CERTIFIED SOLUTION
Avatar of aksteve
aksteve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Justin Malone
Justin Malone

ASKER

Wow i completely forgot about this question, I have just been bussy. points to aksteve, and ill sort it all out later. thanks for the help