N
N
NeveR3d2017-05-31 19:35:31
PHP
NeveR3d, 2017-05-31 19:35:31

Krakozchyabry in a letter?

I can’t understand why the file comes in krakozyabra Like this joxi.ru/J2bY1jdTkPJWm6

<?php
    if (isset ($_POST['nameFF'])) {
        $to = "[email protected]";
        $from = $_POST['nameFF'];
        $subject = "Запрос на подачу рекламы с ".$_SERVER['HTTP_REFERER'];
        $message = "Город: ".$_POST['nameFF']."\nНазвание компании: ".$_POST['nameComp']."\nКатегория: ".$_POST['nameFF1']."\nНомер телефона: ".$_POST['telFF']."\nСсылка ВК: ".$_POST['vk']."\nДата и время: ".$_POST['loginFF']."\nIP: ".$_SERVER['REMOTE_ADDR'];
        $boundary = md5(date('r', time()));
        $filesize = '';
        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "From: " . $from . "\r\n";
        $headers .= "Reply-To: " . $from . "\r\n";
        $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
        $message="
        Content-Type: multipart/mixed; boundary=\"$boundary\"

        --$boundary
        Content-Type: text/plain; charset=\"utf-8\"
        Content-Transfer-Encoding: 7bit

        $message";
        for($i=0;$i<count($_FILES['fileFF']['name']);$i++) {
            if(is_uploaded_file($_FILES['fileFF']['tmp_name'][$i])) {
                $attachment = chunk_split(base64_encode(file_get_contents($_FILES['fileFF']['tmp_name'][$i])));
                $filename = $_FILES['fileFF']['name'][$i];
                $filetype = $_FILES['fileFF']['type'][$i];
                $filesize += $_FILES['fileFF']['size'][$i];
                $message.="

                --$boundary
                Content-Type: \"$filetype\"; name=\"$filename\"
                Content-Transfer-Encoding: base64
                Content-Disposition: attachment; filename=\"$filename\"

                $attachment";
            }
        }
        $message.="
        --$boundary--";

        if ($filesize < 10000000) {
            mail($to, $subject, $message, $headers);
            $output = '<script>alert("Ваше сообщение отправлено! Спасибо!");</script>';
        } else {
            $output = '<script>alert("Извините, письмо не отправлено. Размер всех файлов превышает 10 МБ.");</script>';
        }
    }
    ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-05-31
@NeveR3d

Good evening.
You see the file in these crocs.
how to format a letter with an attachment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question