Ich zeige Dateien an, bevor es per E-Mail als Anhänge gesendet wird. Dies ist upload.php SkriptMehrere Datei-Uploads als E-Mail-Anhänge
<?php
require 'mail/PHPMailerAutoload.php';
include "conn.php";
date_default_timezone_set("Asia/Jakarta");
$id = 1;
$to = '[email protected]';
$subject = 'Test';
if(isset($_POST['submit'])){
$attachment_name = $_FILES['attachment']['name'];
$attachment_type = $_FILES['attachment']['type'];
$attachment = $_FILES['attachment']['tmp_name'];
include 'smtp.php';
$mail->addAddress($to);
$mail->Subject = $subject;
$mail->msgHTML('Tes');
foreach($attachment_name as $key => $att){
$nama_file = $attachment_name[$key];
$tmp_file = $attachment[$key];
$mail->addAttachment($tmp_file, $nama_file);
}
if (!$mail->send()) {
echo '<script>alert("Failed"); </script>';
} else {
echo '<script>alert("Success"); </script>';
}
}
?>
Mein Problem ist, wenn Skript Ich benutze dieses Skript-Dateien als Index und rufen über
<html>
<head>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<form action="upload.php" id="form" method="post" enctype="multipart/form-data">
<div class="fitem">
<label style="width: 400px">Upload Files :</label>
</div>
<div class="fitem" style="float: left">
<input style="width: 65px; height: 75px; float: right" class="easyui-filebox" name="attachment[]" multiple="true" buttonText="Add Files"/>
</div>
<div class="easyui-panel" style="width:440px;height:75px;padding:5px;margin-top:0px">
<p id="file_1" style="list-style-type: none; margin-top: 0px"></p>
</div><br>
</form>
<button type="submit" name="submit" form="form">Send</button>
</body>
</html>
Skript
$(function(){
var ul = $('#po_award p#file_1');
$('#po_award').fileupload({
add: function (e, data) {
var tpl = $('<li class="dialog"><a style="color: #777777"></a></li>');
tpl.find('a').text(data.files[0].name)
.append('<a href="javascript:void(0)"><span style="color: red; float: right">Delete</span></a>');
data.context = tpl.prependTo(ul);
tpl.find('span').click(function(){
if(tpl.hasClass('dialog')){
jqXHR.abort();
}
tpl.fadeOut(function(){
tpl.remove()
});
});
var jqXHR = data.submit();
},
});
});
Und dieses Skript anzuzeigen. js ist im Index enthalten, die Dateien können nicht in E-Mail-Anhängen erscheinen. Wenn script.js jedoch aus dem Index gelöscht wird, können die Dateien in E-Mail-Anhängen angezeigt werden.
Irgendeine Lösung dafür?
sendet, wo Ihre E-Mail-Code ist? –
@Amitray: Ich habe hinzugefügt – Zhumpex
Können Sie Ihre Upload.php-Datei hochladen, da das die Datei ist, in der das Formular eingereicht wird. Sie können pastebin.com auch verwenden, um Ihren Code einzufügen. Nach dem Einfügen senden Sie mir einfach den Link. Wenn die Daten vollständig sind, ist nur die Diagnose einfach. –