Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

koshik

Newbie
  
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

koshik's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

0

Reputation

  1. Разобрался. Проблема в JS - .serializeArray() не принимает файлы
  2. Добрый день. Пытался сделать прикрепление файла, но не работает, т.к. не видит инпут, вот код <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" class="form-horizontal" id="popupcontact"> <div class="form-group required"> <label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label> <div class="col-sm-10"> <input type="text" name="name" value="<?php echo $name; ?>" id="input-name" class="form-control" /> <?php if ($error_name) { ?> <div class="text-danger"><?php echo $error_name; ?></div> <?php } ?> </div> </div> <div class="form-group required"> <label class="col-sm-2 control-label" for="input-phone"><?php echo $entry_phone; ?></label> <div class="col-sm-10"> <input type="text" name="phone" value="<?php echo $phone; ?>" id="input-phone" class="form-control" /> <?php if ($error_phone) { ?> <div class="text-danger"><?php echo $error_phone; ?></div> <?php } ?> </div> </div> <div class="form-group required"> <label class="col-sm-2 control-label" for="input-email"><?php echo $entry_email; ?></label> <div class="col-sm-10"> <input type="text" name="email" value="<?php echo $email; ?>" id="input-email" class="form-control" /> <?php if ($error_email) { ?> <div class="text-danger"><?php echo $error_email; ?></div> <?php } ?> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="input-enquiry"><?php echo $entry_enquiry; ?></label> <div class="col-sm-10"> <textarea name="enquiry" rows="10" id="input-enquiry" class="form-control"><?php echo $enquiry; ?></textarea> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label" for="input-file"><?php echo $entry_file1; ?></label> <div class="col-sm-9"> <input type="file" name="file[]" value="" multiple="multiple" /> </div> </div> <?php echo $captcha; ?> </form> и PHP $mail = new Mail(); $mail->protocol = $this->config->get('config_mail_protocol'); $mail->parameter = $this->config->get('config_mail_parameter'); $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); $mail->smtp_username = $this->config->get('config_mail_smtp_username'); $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); $mail->smtp_port = $this->config->get('config_mail_smtp_port'); $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); $mail->setTo($this->config->get('config_email')); $mail->setFrom($this->config->get('config_email')); $mail->setReplyTo($this->request->post['email']); $mail->setSender($this->config->get('config_name')); $mail->setSubject($this->language->get('email_subject_ur')); $email_text = "Имя: " . html_entity_decode($this->request->post['name']) . "\n "; $email_text .= "Email: " . html_entity_decode($this->request->post['email']) . "\n "; $email_text .= "Телефон: " . html_entity_decode($this->request->post['phone']) . "\n "; if(!empty($this->request->post['enquiry'])) $email_text .= "Сообщение: " . html_entity_decode($this->request->post['enquiry']) . "\n"; $files = array(); if ($this->request->files['file']['name'] && is_array($this->request->files['file']['name'])) { foreach (array_keys($this->request->files['file']['name']) as $key) { $files[] = array( 'name' => $this->request->files['file']['name'][$key], 'type' => $this->request->files['file']['type'][$key], 'tmp_name' => $this->request->files['file']['tmp_name'][$key], 'error' => $this->request->files['file']['error'][$key], 'size' => $this->request->files['file']['size'][$key] ); } } foreach($files as $file) { $mail->addAttachment($file); } $mail->setText($email_text); $mail->send(); Выдает ошибку с тем, что не видит инпут и не получает с него данные. Прощу помочь. Грубо говоря не видит <input type="file" name="file[]" value="" multiple="multiple" /> вообще никак Notice: Undefined index: file in /catalog/controller/information/popupcontact.php on line 52Array ( )
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.