Arama butonu
Bu konudaki kullanıcılar: 1 misafir
6
Cevap
668
Tıklama
0
Öne Çıkarma
Php mailler ve Dosya Yükleme
E
11 yıl
Yüzbaşı
Konu Sahibi

Merhaba,

Uzun süredir uğraştığım bir sorun bu. Formumda bir adet input file var ve ben burdan maile attachment göndermek istiyorum. Bunu nasıl yapabilirim. Denediğim hiç bir yol olmadı.

<?php



if ($_POST){

$adsoyad = htmlspecialchars(trim($_POST['adsoyad']));
$eposta = htmlspecialchars(trim($_POST['eposta']));
$telefon = htmlspecialchars(trim($_POST['telefon']));
$website = htmlspecialchars(trim($_POST['website']));
$dosyukle = $_FILES[dosyukle];





include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = 'xxxxxxxxx@gmail.com';
$mail->Password = 'xxxxxxx';
$mail->SetFrom($mail->Username, $adsoyad);
$mail->AddAddress('xxxxxxx@gmail.com', $adsoyad);
$mail->CharSet = 'UTF-8';
$mail->Subject = ' Application From: ' . $adsoyad . ' /' ;
$mail->AddAttachment($_FILES['dosyukle'];
$e_body = "Contacting person is: <strong>$adsoyad </strong> <br> Website: <strong>$website</strong><br> Phone: <strong>$telefon <br>$konum</strong><br> " . PHP_EOL . PHP_EOL;
$e_reply = "<br>You can contact <strong> $adsoyad </strong> via email, $eposta";
$msg = wordwrap( $e_body . $e_reply, 170 );
$content = '<div style="background: #eee; padding: 10px; font-size: 14px">'.$msg.'</div>';
if($adsoyad == '') {
echo 'Lütfen isminizi Yazın;
} else if(trim($eposta) == ''){
echo 'Lütfen eposta adresinizi yazın';
} else if(trim($telefon) == ''){
echo 'lütfen tel no yazınız.';
} else{
$mail->MsgHTML($content);

}

if($mail->Send()) {

echo 'Mesajınız Ulaştı';
}
}

?>


Bunu nasıl çözebilirim.



C
11 yıl
Teğmen

E
11 yıl
Yüzbaşı
Konu Sahibi

quote:

Orijinalden alıntı: CatchFire

AJAX ile bu şekilde dosya yüklemen imkansız.
Şu konuları incelersen sorununu çözersin:
http://stackoverflow.com/questions/4006520/using-html5-file-uploads-with-ajax-and-jquery
http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery



Teşekkürler, bu şekilde de deneyeceğim



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.