Witajcie.
W którym miejscu kodu formularza wstawić kod odpowiedzialny za czytanie zadanego pliku txt aby jego zawartość została wysłana
formularz
<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
}
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = 'moj.email@o2.pl';
$mailfrom = isset($_POST['email']) ?
$_POST['email'] : $mailto; $subject = 'Contact Information';
$message = 'Values submitted from web site form:';
$success_url = '';
$error_url = '';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ?
$_POST['filesize'] * 1024
: 1024000;
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
{
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode); }
$internalfields = array ("submit", "reset", "send", "captcha_code"); $message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
foreach ($_POST as $key => $value)
{
{
{
}
else
{
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header); header('Location: '.$success_url); }
?>
czytanie pliku
Pozdrawiam.