'Time: ' . date('H:i:s ') . "\n" .
'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'] . "\n" .
'Remote-Addr: ' . $_SERVER['REMOTE_ADDR'] . "\n";
+
+ $attachment = '';
+ if ( isset( $_FILES ) && is_array( $_FILES )
+ && isset( $_FILES['file_upload'] ) && !$_FILES['file_upload']['error'] ) {
+ // move the uploaded file
+ $upload_path = wp_upload_dir();
+ $file_name = $upload_path['basedir'] . '/' . $_FILES['file_upload']['name'];
+ $fileUploaded = move_uploaded_file( $_FILES['file_upload']['tmp_name'], $file_name );
+ echo '<pre>$_FILES: ' . print_r( $_FILES, true ) . '</pre>';
+ if ( $fileUploaded ) {
+ $attachment = $fileUploaded;
+ }
+ }
+
wp_mail(
GLM_SUPPORT_SUPPORT_EMAIL.','.$email.','.$values['email'],
GLM_SUPPORT_SUBJECT,
$msg,
- $hdrs
+ $hdrs,
+ $attachment
);
}
}
margin: 1em 0;
}
table {
- width: 600px;
+ width: 610px;
}
.req {
color: red;
<p>Please provide as much information as you can.</p>
</div>
<div>
- <form action="<?php echo $supportFormActionUrl;?>" method="post">
+ <form action="<?php echo $supportFormActionUrl;?>" method="post" enctype="multipart/form-data">
<table>
<tr>
<td colspan="2"><b>Please help us provide the proper support</b></td>
<textarea name="problem" required></textarea>
</td>
</tr>
+ <tr>
+ <td>
+ <span class="req">*</span> Upload a screenshot: (jpg,gif,png)
+ </td>
+ <td>
+ <input type="file" name="file_upload" />
+ </td>
+ </tr>
<tr>
<td></td>
<td>
</form>
</div>
</div><!-- #supportWrapper -->
- </div>
\ No newline at end of file
+ </div>