Strona 1 z 1

[php] formularz z wieloma zalacznikami

: ndz wrz 04, 2005 11:58 am
autor: ppsi
Mam problemik ponieaz kozystam ze skryptu ktory wysla zalacznik na ades e-mail. Chcialbym przerobic ten skryp aby wysyłał 2 i wiecj zalcznikow jednorazowo. KOD html wyglada tak

Kod: Zaznacz cały

Wybiez plik do załączenia:<br>
<input type="file" name="filename">
A KOD PHP tak :
[php]<?php
$boundary = "-->===_54654747_===<---->>4255==_";

$head = "From: [email protected]\n";
$head = $head . "Reply-To: $email\n";
$head = $head . "X-Mailer: PHP\n";
$head = $head . "X-Sender: [email protected]\n";
$head = $head . "MIME-version: 1.0\n";
$head = $head . "Content-type: multipart/mixed; ";
$head = $head . "boundary=\"$boundary\"\n";
$head = $head . "Content-transfer-encoding: 7BIT\n";
$head = $head . "X-attachments: $filename_name;\n\n";



$mesg = "--" . $boundary . "\n";
$mesg = $mesg . "Content-Type: text/plain; charset=\"us-ascii\"\n\n";
$mesg = $mesg
.$imie = "IMIE: $imie" ."\n"
.$nazwisko = "NAZWISKO: $nazwisko" ."\n"
.$adres = "ADRES: $adres" ."\n"
.$telefon = "NR TELEFONU: $telefon" ."\n"
.$email = "E-MAIL: $email" ."\n";
$mesg = $mesg . "--" . $boundary . "\n";
$mesg = $mesg . "Content-type: " . $filename_type . "; name=\"$filename_name\";\n";
$mesg = $mesg . "Content-Transfer-Encoding: base64\n";
$mesg = $mesg . "Content-disposition: attachment; filename= \"$filename_name\"\n\n";
$mesg = $mesg . fileopenanddecode($filename) . "\n";
$mesg = $mesg . "--" . $boundary . "-- \n";



function fileopenanddecode($file) {
if (is_readable($file)) {
$fd = fopen($file, "r");
$plik = fread($fd, filesize($file));
$encoded = chunk_split(base64_encode($plik));
fclose($fd);
}
return $encoded;
}



mail("mojemail", "ProPsi", $mesg , $head);

?>[/php]

Prosze o pomoc jak przerobobic ten skrypt abym mogl wysylac np 2 lub 3 zalczniki dziekuje slicznie pozdrowka papatki

Re: [php] formularz z wieloma zalacznikami

: ndz wrz 04, 2005 3:49 pm
autor: Riklaunim
zobacz końcówkę tego artykułu :)