Alec Walczak
Alec Walczak

Reputation: 447

Mura CMS v7 Simple Form File Upload

I created a simple form from an html template, and it successfully collects data and emails it to the correct address.

The problem is when I insert a file upload field (type=file), it does not send the attachment (only the path) or upload the attachment.

Does anyone know what I can use to upload files in a simple form? Note: I have limited CFML experience.

Form 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">&nbsp;</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>

Upvotes: 0

Views: 344

Answers (1)

Jamie Jackson
Jamie Jackson

Reputation: 1305

A couple things to try:

  • Add method=post to the form tag.
  • Use cffile action = "upload" in the code that processes the form submission.

Reference:

Upvotes: 0

Related Questions