forms - PHP - no attachment in mailbox [POST] -


i have code in php sending message attachment. code works fine instead of attachment. when attach file , click "wyślij wiadomość" (send) have message in mailbox there`s nothing attached. think did wrong place put $formfile

 $mailtext = "treść wiadomości:\n$formtext\nod: $formname, $formemail, $formfile, ($ip, $host)"; 

here`s full code:

<?php //--- początek formularza --- if(empty($_post['submit'])) { ?>             <form action="" method="post" enctype="multipart/form-data">                         <table class="col-md-10 col-sm-12 col-xs-12">                             <tr>                                 <td class="col-md-2">nazwisko:<br /><br/></td>                                 <td><input type="text" name="formname" /></td>                             </tr>             <tr>                             <td class="col-md-2">e-mail:<br /><br/></td>                             <td><input type="text" name="formemail"/></td>                         </tr>                         <tr>                             <td class="col-md-2">zaŁĄcz kosztorys:<br /><br/></td>                             <td><input type="file" name="formfile" /></td>                         </tr>                         <tr>                             <td class="formularztresc col-md-2">treŚĆ:<br /><br/></td>                             <td><textarea name="formtext"></textarea></td>                         </tr>                         <tr>                             <td></td>                             <td><p align="right"><input type="submit" name="submit" value="wyślij wiadomość" /><p></td>                         </tr>                         </table>                     </form> <?php } else {  //twoje dane $email = 'e-mail';  //dane z formularza $formname = $_post['formname']; $formemail = $_post['formemail']; $formtext = $_post['formtext']; $formfile = $_files['formfile'];  if(!empty($formname) && !empty($formemail) && !empty($formtext)) {  //--- początek funkcji weryfikującej adres e-mail --- function checkmail($checkmail) {   if(filter_var($checkmail, filter_validate_email)) {     if(checkdnsrr(array_pop(explode("@",$checkmail)),"mx")){         return true;       }else{         return false;       }   } else {     return false;   } } //--- koniec funkcji --- if(checkmail($formemail)) {   //dodatkowe informacje: ip host użytkownika   $ip = $_server['remote_addr'];   $host = gethostbyaddr($_server['remote_addr']);    //tworzymy szkielet wiadomości   //treść wiadomości   $mailtext = "treść wiadomości:\n$formtext\nod: $formname, $formemail, $formfile, ($ip, $host)";    //adres zwrotny   $mailheader = "from: $formname <$formemail>\r\n";     $mailheader .= "content-type: text/plain; charset=utf-8\r\n";         $target_path = "../przeslanepliki";         $target_path = $target_path . basename( $_files['formfile']['name']); if(move_uploaded_file($_files['formfile']['tmp_name'], $target_path)) {     echo "the file ".  basename( $_files['formfile']['name']).      " has been sent. ";  } else{     echo "problem sending file."; }    //funkcja odpowiedzialna za wysłanie e-maila   @mail($email, 'pytanie eksperta', $mailtext, $mailheader) or die('błąd: wiadomość nie została wysłana');    //komunikat o poprawnym wysłaniu wiadomości   echo 'wiadomość została wysłana'; } else {   echo 'adres e-mail jest niepoprawny'; }  } else {   //komunikat w przypadku nie powodzenia   echo 'wypełnij wszystkie pola formularza'; }  //--- koniec formularza --- } ?> 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -