hankknight
asked on
emailing file as attachement from form submission
Hello.
I use the following to process form submissions.
It uploads the file submitted to the server and sends a notice to the webmaster.
I don't want the file to be uploaded. Instead, I want the file to be emailed to the webmaster as an attachement, along with the notice.
How can this be done?
Thanks!
-------------------------- ---------- ---------- ---------- ---------- -------
<?php
ob_start();
include("../lib/global.inc .php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$file2upload=$HTTP_POST_FI LES["file2 upload"];
if(!is_uploaded_file($HTTP _POST_FILE S["file2up load"]["tm p_name"])) {
$error.="<li>The file, ".$HTTP_POST_FILES["file2u pload"]["n ame"].", was not uploaded!";
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_PO ST_FILES[" file2uploa d"]["name" ];
$image_list[0] = $image_part;
copy($HTTP_POST_FILES["fil e2upload"] ["tmp_name "], "files/".$image_part);
$message="file2upload: ".$where_form_is."files/". $image_lis t[0]."
";
$message = stripslashes($message);
@mail("me@myemail.com","Fo rm Submitted at your website",$message,"From: me@myemail.com");}
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF ']) . "/" . $relative_url);
ob_end_flush();
?>
-------------------------- ---------- ---------- ---------- ---------- -------
I use the following to process form submissions.
It uploads the file submitted to the server and sends a notice to the webmaster.
I don't want the file to be uploaded. Instead, I want the file to be emailed to the webmaster as an attachement, along with the notice.
How can this be done?
Thanks!
--------------------------
<?php
ob_start();
include("../lib/global.inc
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$file2upload=$HTTP_POST_FI
if(!is_uploaded_file($HTTP
$error.="<li>The file, ".$HTTP_POST_FILES["file2u
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_PO
$image_list[0] = $image_part;
copy($HTTP_POST_FILES["fil
$message="file2upload: ".$where_form_is."files/".
";
$message = stripslashes($message);
@mail("me@myemail.com","Fo
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF
ob_end_flush();
?>
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you need it.