Accueil du forum » PHP » téléchargement d'images
include("config.inc");
include("mailsend.inc");
$img_info = getimagesize($bild);
if ($bild) {
if ($img_info[2] == '2') {
$bildneu = "".$name."1.jpg";
} else {
include("error.php");
exit;
}
}
if ($bild) {
copy($bild,$bildneu); // Kopiert das Bild
$attachment = fread(fopen($bildneu, "r"), filesize($bildneu));
}
$header.="Kundenname: ".$name."\n\n";
$header.="Kundenmail: ".$email."\n\n";
$header.="Bestellnummer: ".$betreff."";
$mail = new mime_mail();
$mail->headers = "Message-ID: <$mail_from>";
$mail->headers = "X-Mailer: PHP/".phpversion()."";
$mail->headers = "X-Sender-IP: $REMOTE_ADDR";
$mail->from = "$email";
$mail->headers = "Errors-To: $mail_from";
$mail->to = "$mail_from";
$mail->subject = "Bildversand über Shopsystem";
$mail->body = "$header";
if ($bildneu) {
if(eregi("(jpg)$",$bildneu)) {
$mail->add_attachment("$attachment", $bildneu, "image/jpeg");
}
}
$mail->send();
@unlink($bildneu); // Löscht das temporäre Bild
include("ok.php");
?>
<?
class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
function mime_mail()
{
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}
function add_attachment($message, $name = "", $ctype = "application/octet-stream")
{
$this->parts[] = array (
"ctype" => $ctype,
"message" => $message,
"encode" => $encode,
"name" => $name
);
}
function build_message($part)
{
$message = $part["message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
if ($part["name"]!="") {
$dispstring = "Content-Disposition: attachment; filename=\"$part[name]\"\n";
}
return "Content-Type: ".$part["ctype"].
($part["name"]?"; name = \"".$part["name"]."\"" : "").
"\nContent-Transfer-Encoding: $encoding\n".$dispstring."\n$message\n";
}
function build_multipart()
{
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary=$boundary\n\nThis is a MIME encoded message.\n\n--$boundary";
for($i = sizeof($this->parts)-1; $i >= 0; $i--)
{
$multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary";
}
return $multipart.= "--\n";
}
function send()
{
$mime = "";
if (!empty($this->from))
$mime .= "From: ".$this->from."\n";
if (!empty($this->headers))
$mime .= $this->headers."\n";
if (!empty($this->body))
$this->add_attachment($this->body, "", "text/plain");
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();
$success = mail($this->to, $this->subject, "", $mime);
}
};
?>
________________
mojchris
Aucune réponse pour le moment.
- Les conditions générales d'utilisation du site
| Sujet | Forum |
|---|---|
Réponse postée par raptor le 27/11/2008 à 20h39'51 |
![]() |
Réponse postée par tieno le 26/11/2008 à 14h54'54 |
![]() |
Réponse postée par tieno le 23/11/2008 à 13h55'24 |
![]() |
Sujet posté par touret le 13/11/2008 à 08h58'09 |
![]() |
Réponse postée par xerses le 09/11/2008 à 18h57'14 |
![]() |
Réponse postée par unit le 03/11/2008 à 15h53'53 |
![]() |
Réponse postée par froogy le 26/10/2008 à 16h40'03 |
![]() |
Réponse postée par rer le 23/10/2008 à 16h11'03 |
![]() |
Réponse postée par 1cyril le 19/10/2008 à 19h26'02 |
![]() |
Réponse postée par xerses le 13/10/2008 à 12h41'06 |
![]() |