HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
HTML Email Form; Image Attach
Goto page Previous  1, 2
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Tools
View previous topic :: View next topic  
Author Message
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8431
Location: Castle Pines North, CO USA

PostPosted: Wed Feb 27, 2008 8:55 am     Reply with quote



Once the user has their e-mail opened, your coding has stopped from there. It will be up to the user to find the e-mail.

_________________
Corey
Hosting Solutions | Mile High Merchant Accounts | Expression Web Blog
tucker



Joined: 31 May 2008
Posts: 1

PostPosted: Sat May 31, 2008 2:10 pm     attaching a image to a contact form Reply with quote

hello joined the forum today aftr reading this thread aftr a lot of reasearch i can now add a image to a contact form

html code is a simple form

html folder
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form enctype="multipart/form-data" action="test.php" method = "post" >



<p>
<input type="file" name="attachment" />
</p>

<p>&nbsp;</p>
<p>

<input name="submit" type="submit" </form>
</body>
</html>

the php folder is
<html>
<head>
<title></title>
</head>
<body>
<?php
$mime_boundary = "<<<--==+X[".md5(time())."]";
$file = $_POST ['attachment'];
$headers .= "From: Automatic <chrisatdirectelitewebsites.co.uk>\r\n";
$headers .= "To:yourname<yournameatwebmail.co.uk>\r\n";

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed;\r\n";
$headers .= " boundary=\"".$mime_boundary."\"";

$message .= "This is a multi-part message in MIME format.\r\n";
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";


$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "\r\n";
$message .= "Email content and what not: \r\n";
$message .= "This is the file you asked for! \r\n";
$message .= "--".$mime_boundary."\r\n";


$message .= "Content-Type: application/octet-stream;\r\n";
$message .= "attachment=\"filename.extn\"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n";
$message .= "Content-Disposition: attachment;\r\n";
$message .= " filename=\"filename.extn\"\r\n";
$message .= "\r\n";
$message .= $file;
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";




$ok = mail("yournameatwebsite.co.uk", "file by email", $message, $headers, $file);

?>
</body>
</html>

this will attach a image to an email the problem is its sending me a .dat extension that i carnt open and i am attaching a .jpg so its a start if any one can make this work please help me,i have only beeen learning php 2 weeks so dont think i have done to bad thank you
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Tools All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial