我有以下html
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="text" placeholder="NAME" class="name">
<input type="text" placeholder="EMAIL" class="email">
<input type="text" placeholder="LINK TO REEL/BREAKDOWNS" class="reel">
<input type="text" placeholder="SKILLSETS" class="skill">
<input type="text" placeholder="SALARY REQUIREMENTS" class="salary">
<p>Upload Your Resume (pdf only)</p>
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="APPLY" name="submit">
</form>
如何使用jQuery验证字段并使用ajax上传文件。我的后端是php。
答案 0 :(得分:1)
答案 1 :(得分:1)
提示使用formData
var t_formdata = new formData(); //this will bind entire form (also upload data)
url : 'your url',
data:t_formdata,
success:function(){
}
如果你不使用formData,它将只显示数据而不是文件部分
了解更多https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects