Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form enctype="multipart/form-data" method="post" id="contact-form-block-1">
- <div>
- <div class="icon">
- <input class="form-control contact-name" type="text" name="contact_name" required="" placeholder="Имя">
- </div>
- <div class="des">
- <input class="form-control contact-file" type="file" name="contact_file">
- </div>
- <input type="submit" value="Отправить заявку">
- </div>
- </form>
- jQuery(function($){
- $('form').each(function (index) {
- $(this).attr('id', 'gfort-contact-form-block-' + index);
- $('#gfort-contact-form-block-' + index).submit(function () {
- var el = $(this),
- formValues = new FormData(el);
- $.ajax({
- url: 'http://<?=$_SERVER["HTTP_HOST"]?>/include/contact.php',
- data: formValues,
- processData: false,
- contentType: false,
- type: 'POST',
- success: function (response) {
- }
- });
- */
- return false;
- });
- return false;
- });
- });
- if(isset($_POST)){
- $email_address = "<........>";
- if(isset($_FILES['contact_file'])){
- $uploaddir = '<........>';
- $uploadfile = $uploaddir . basename($_FILES['contact_file']['name']);
- if (move_uploaded_file($_FILES['contact_file']['tmp_name'], $uploadfile)) {
- $contact_file = 'Файл: <a href="http://'.$_SERVER["HTTP_HOST"].'/userfiles/'.basename($_FILES['contact_file']['name']).'">скачать</a><br>';
- } else {
- echo '<div class="error-file">Ошибка отправки файла.</div>';
- return false;
- }
- }
- }
- $send_subject = "123";
- $send_message = $contact_file;
- $headers = "<........>";
- if (mail($email_address, $send_subject, $contact_file, $headers)) { */
- echo '<div class="success-message">удачно</div>';
- return false;
- } else {
- echo 'Ошибка';
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement