Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Ajax Json to PHP Form Attachment not going through?
    primarykey
    data
    text
    <p>after pulling my hair out for two days trying to figure this issue out I finally decided to join this community as a last resort in search of some serious aid.</p> <p>Basically I have a form that is supposed to send an email along side an attachment (like a resume / C.V) that a user as uploaded. I am using Jquery to validate on clientside and Ajax / Json to send the form to my PHP mailer file and get a response back etc without refreshing. </p> <p>The email portion of everything works perfectly but somehow the attachment is not reaching me.<br> This is my Jquery code below, Im praying someone out there will know where this noob is messing up...</p> <pre><code> $('#jobsubmit').click(function(e){ e.preventDefault(); var valid = ''; var required = 'is required'; var fileUpload = $('form#jobform #cv_upload').val().split('.').pop().toLowerCase(); var allow = new Array('jpg','wps','odf','txt','rtf','doc','docx','pdf'); var jobtitle = $('form#jobform #job_title').val(); var name = $('form#jobform #job_name').val(); var email = $('form#jobform #job_email').val(); var contactnumber = $('form#jobform #job_number').val(); var portfolio = $('form#jobform #job_portfolio').val(); var honeypot = $('form#jobform #honeypot').val(); var humancheck = $('form#jobform #humancheck').val(); if(name = '' || name.length &lt;= 2) { valid = '&lt;p class= \"errortext_jobs\"&gt;Your name ' + required + '&lt;/p&gt;'; } if(jQuery.inArray(fileUpload, allow) == -1) { valid += '&lt;p class= \"errortext_jobs\"&gt;Please select a valid C.V file type to upload.&lt;/p&gt;'; } if(!email.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) { valid += '&lt;p class=\"errortext_jobs\"&gt;Your email ' + required + '&lt;/p&gt;'; } if(!contactnumber.match(/^([0-9]+)$/)) { valid += '&lt;p class=\"errortext_jobs\"&gt;Your number ' + required + '&lt;/p&gt;'; } if(honeypot != 'http://') { valid += '&lt;p class=\"errortext_jobs\"&gt;Spambots are not allowed&lt;/p&gt;'; } if(humancheck != '') { valid += '&lt;p class= \"errortext_jobs\"&gt;A Human user ' + required + '&lt;/p&gt;'; } if (valid != '') { $('#job_response').removeClass() .addClass('error') .html('&lt;p class= \"errortitle\"&gt; Please correct the errors below &lt;/p&gt;' + valid) .fadeIn('fast'); } else { $('#job_response').removeClass() .addClass('form_processing') .html('&lt;p class= \"processtitle\"&gt;Processing...&lt;/p&gt;') .fadeIn('fast'); var formData = $('form#jobform').serialize(); submitForm(formData); } }); }); function submitForm(formData) { $.ajax({ type:'POST', url:'jobengine.php5', data: formData, dataType: 'json', timeout: 7000, success: function(data) { $('#job_response').removeClass() .addClass((data.error === true) ? 'error' : 'success') .html(data.msg).fadeIn('fast'); if ($('#job_response').hasClass('success')) { setTimeout("$('#job_response').fadeOut('slow')", 5000); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ $('#job_response') .removeClass().addClass('error') .html('&lt;p class= \"errortext_jobs\"&gt;There was an ' + errorThrown + '&lt;/p&gt;' + '&lt;p class= \"errortext_jobs\"&gt; error due to an ' + textStatus + '&lt;/p&gt;' + '&lt;p class= \"errortext_jobs\"&gt; condition. &lt;/p&gt;').fadeIn('fast'); }, complete: function(XMLHttpRequest, status){ $('form#jobform')[0].reset(); } }); </code></pre> <p>And this is the HTML portion below:</p> <pre><code> &lt;form id="jobform" method="post" action="jobengine.php5" enctype="multipart/form-data"&gt; &lt;p class="formtext_job" &gt;Job Position:&lt;/p&gt; &lt;input type="text" name="job_title" id="job_title"/&gt; &lt;p class="formtext_job" &gt;Your Name:&lt;span class="red"&gt;*&lt;/span&gt; &lt;/p&gt; &lt;input type="text" name="job_name" id="job_name"/&gt; &lt;p class="formtext_job" &gt;Your Email:&lt;span class="red"&gt;*&lt;/span&gt;&lt;/p&gt; &lt;input type="text" name="job_email" id="job_email"/&gt; &lt;p class="formtext_job" &gt;Your Contact Number:&lt;span class="red"&gt;*&lt;/span&gt;&lt;/p&gt; &lt;input type="text" name="job_number" id="job_number"/&gt; &lt;p class="formtext_job" &gt;Your Website:&lt;/p&gt;&lt;span class="italicgrey"&gt;(If applicable) &lt;/span&gt; &lt;input type="text" name="job_portfolio" id="job_portfolio"/&gt; &lt;div class="input_pos"&gt; &lt;p class="formtext_job2" &gt;Attach your C.V :&lt;/p&gt; &lt;div class="uploadimg"&gt; &lt;input type="file" id="cv_upload" name="cv_upload" /&gt; &lt;/div&gt; &lt;div id="upload_list"&gt;&lt;/div&gt; &lt;/div&gt; &lt;input type="image" name="jobsubmit" value="submit" src= "../images/buttons/form_buttons/apply_button.jpg" id="jobsubmit" /&gt; &lt;input type="hidden" name="honeypot" id="honeypot" value="http://" /&gt; &lt;input type="hidden" name="humancheck" id="humancheck" class="clear" value="" /&gt; &lt;/form&gt; </code></pre> <p>If more info is required please let me know as I have be fighting this thing for so long...</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload