du skal ikke bruge hele tekst filen
<?php
if ($_GET['send']){
$boundary = uniqid("");
if ($_FILES['filen']['type']) {
$mimeType = $_FILES['filen']['type'];
} else {
$mimeType = "application/unknown";
}
$fil_var = fread(fopen($_FILES['filen']['tmp_name'], "r"), filesize($_FILES['filen']['tmp_name']));
$fil_var = base64_encode($fil_var);
$fil_var = chunk_split($fil_var);
$body = "\\n--$boundary\\n";
$body .= "Content-type: text/plain; charset=iso-8859-1\\n";
$body .= "Content-transfer-encoding: 8bit\\n\\n";
$body .= $_POST['body_text']."\\n\\n";
$body .= "--$boundary\\n";
$body .= "Content-type: $mimeType; name=".$_FILES['filen']['name']."\\n";
$body .= "Content-disposition: attachment; filename=".$_FILES['filen']['name']."\\n";
$body .= "Content-transfer-encoding: base64\\n\\n";
$body .= $fil_var."\\n\\n";
$body .= "--$boundary--";
$headers = "From: ".$_POST['fra']."<x@z.com>\\n";
$headers .= "Content-type: multipart/mixed; boundary=\\"$boundary\\"";
// Hvis mailen bliver sendt afsted problemfrit
if (mail("din@email.dk", "Emnet", $body, $headers)) {
echo "Mailen er sendt!";
} else {
echo "Der opstod en fejl, og mailen blev ikke sendt!";
}
} else {
echo "<form action='".basename($PHP_SELF)."?send=1' enctype='multipart/form-data' method='post'>\\n";
echo "<table>\\n";
echo "<tr><td>Fra:</td><td><input type='text' name='fra'></td></tr>\\n";
echo "<tr><td>Fil:</td><td><input type='file' name='filen'></td></tr>\\n";
echo "<tr><td>Body:</td><td><textarea name='body_text'></textarea></td></tr>\\n";
echo "<tr><td></td><td><input type='submit' value='Send'></td></tr>\\n";
echo "</table>\\n</form>\\n";
}
?>
ikke testet
-------------------------------------------
Husk At Besøge www.GenerationX.dk
-------------------------------------------
jeg ved ikke hvad jeg gør forkert men den gør det samme.
jeg setter det ind sådan her
<html>
<head>
<title>Nyt dokument</title>
</head>
<body>
<?php
if ($_GET['send']){
$boundary = uniqid("");
if ($_FILES['filen']['type']) {
$mimeType = $_FILES['filen']['type'];
} else {
$mimeType = "application/unknown";
}
$fil_var = fread(fopen($_FILES['filen']['tmp_name'], "r"), filesize($_FILES['filen']['tmp_name']));
$fil_var = base64_encode($fil_var);
$fil_var = chunk_split($fil_var);
$body = "\\n--$boundary\\n";
$body .= "Content-type: text/plain; charset=iso-8859-1\\n";
$body .= "Content-transfer-encoding: 8bit\\n\\n";
$body .= $_POST['body_text']."\\n\\n";
$body .= "--$boundary\\n";
$body .= "Content-type: $mimeType; name=".$_FILES['filen']['name']."\\n";
$body .= "Content-disposition: attachment; filename=".$_FILES['filen']['name']."\\n";
$body .= "Content-transfer-encoding: base64\\n\\n";
$body .= $fil_var."\\n\\n";
$body .= "--$boundary--";
$headers = "From: ".$_POST['fra']."<x@z.com>\\n";
$headers .= "Content-type: multipart/mixed; boundary=\\"$boundary\\"";
// Hvis mailen bliver sendt afsted problemfrit
if (mail("din@email.dk", "Emnet", $body, $headers)) {
echo "Mailen er sendt!";
} else {
echo "Der opstod en fejl, og mailen blev ikke sendt!";
}
} else {
echo "<form action='".basename($PHP_SELF)."?send=1' enctype='multipart/form-data' method='post'>\\n";
echo "<table>\\n";
echo "<tr><td>Fra:</td><td><input type='text' name='fra'></td></tr>\\n";
echo "<tr><td>Fil:</td><td><input type='file' name='filen'></td></tr>\\n";
echo "<tr><td>Body:</td><td><textarea name='body_text'></textarea></td></tr>\\n";
echo "<tr><td></td><td><input type='submit' value='Send'></td></tr>\\n";
echo "</table>\\n</form>\\n";
}
?>
</body>
</html>
undskyld hvis jeg gør det forkert men jeg er lige startet på php
vær sød at hjelpe jeg skal bruge det snart der må være noget jeg har misforstået