我从html模板创建了一个简单的表单,它成功地收集数据并通过电子邮件将其发送到正确的地址。
问题是当我插入文件上传字段(type = file)时,它不会发送附件(只有路径)或上传附件。
有谁知道我可以用什么来以简单的形式上传文件?注意:我的CFML经验有限。
表格html:
<form class="floraforms theme-black" enctype="multipart/form-data" id="floraforms">
<div class="frm-row">
<div class="elem-group colm colm6"><label class="field prepend-icon"><input class="flo-input" id="name" name="name" placeholder="Your Name" type="text" /> <b class="flo-tooltip tip-left"><em>Please type your full name</em></b> <span class="field-icon"><i class="fa fa-user"></i></span> </label></div>
<!-- end .colm section section -->
<div class="elem-group colm colm6"><label class="field prepend-icon"><input class="flo-input" id="emailaddress" name="email" placeholder="Your Email" type="text" /> <span class="field-icon"><i class="fa fa-envelope"></i></span> </label></div>
<!-- end .colm section section --></div>
<!-- end .frm-row section -->
<div class="frm-row">
<div class="elem-group colm colm6"><label class="field prepend-icon"><input class="flo-input" id="telephone" name="phone" placeholder="Your Phone Number" type="text" /> <span class="field-icon"><i class="fa fa-mobile"></i></span> </label></div>
<!-- end .colm section section -->
<div class="elem-group colm colm6"><label class="field prepend-icon"><input class="flo-input" id="subject" name="subject" placeholder="Position Title" type="text" /> <b class="flo-tooltip tip-left"><em>Position Title</em></b> <span class="field-icon"><i class="fa fa-filter"></i></span> </label></div>
<!-- end .colm section section --></div>
<!-- end .frm-row section -->
<div class="elem-group colm colm6"><label class="field flo-file prepend-icon"><span class="flo-button">Select Resume </span> <input class="file-input" id="uploadfile1" name="resume" onchange="document.getElementById('upload1').value = this.value.replace(/\\/g,'/').replace( /.*\//, '' );" type="file" /> <input class="flo-input" id="upload1" placeholder="Upload Resume" readonly="readonly" type="text" /> <span class="field-icon"><i class="fa fa-paperclip"></i></span> </label> <span class="flo-note">Upload format: DOC, DOCX, PDF, RTF, or TXT - Files maximum size 3MB </span></div>
<!-- end .elem-group section -->
<div class="frm-row">
<div class="elem-group" style="padding: 0 10px;"><label class="field"><textarea class="flo-textarea" id="message" name="message" placeholder="Enter your message"></textarea> <!-- <span class="flo-hint"><strong>Please provide as much information as possible</strong></span> --> </label></div>
<!-- end .elem-group section -->
<div class="response"> </div>
</div>
<!-- end .frm-body section -->
<div class="frm-footer"><button class="flo-button" style="margin-right: 4px;" type="reset">Cancel</button><button class="flo-button btn-themed" data-btntext-sending="Sending..." type="submit">Submit Form</button></div>
<!-- end .frm-footer section -->
</form>
答案 0 :(得分:0)
有几件事要尝试:
method=post
添加到表单标记。cffile action = "upload"
。参考: