Highlighted

Contact form with ability up add CV / resume

New Here ,
Dec 14, 2017

Copy link to clipboard

Copied

Hi

I am building a website and the client would like a form on the site were people can send him a CV / resume.

I have built a basic form in Coldfusion, but this asks for name, email message etc. and sends this information as an email.

How do I create a extra bit that adds a pdf file to the email? How does this work?

Any simple/clear answers would be great

Many thanks

Mark

Views

519

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Contact form with ability up add CV / resume

New Here ,
Dec 14, 2017

Copy link to clipboard

Copied

Hi

I am building a website and the client would like a form on the site were people can send him a CV / resume.

I have built a basic form in Coldfusion, but this asks for name, email message etc. and sends this information as an email.

How do I create a extra bit that adds a pdf file to the email? How does this work?

Any simple/clear answers would be great

Many thanks

Mark

Views

520

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 14, 2017 0
LEGEND ,
Dec 14, 2017

Copy link to clipboard

Copied

Assuming that you are using CFMAIL to send the information, the resume would be attached using CFMAILPARAM inside the CFMAIL.

HTH,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Engaged ,
Dec 14, 2017

Copy link to clipboard

Copied

I'll add to the answer above (which shows how to attach the file to an email using <cfmailparam file="#form.whateverFileField#"/>).  If you need a local copy of the file for posterity, or want to do some basic checks to make sure you aren't mailing .exe files or whatnot, after your form post (be sure to set the encoding to "multipart/form-data") you can use <cffile/> to process the file:

ColdFusion Help | cffile action = "upload"

And based on results can provide error messages back to the user (such as PDF or size restrictions).

-Nic

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
LEGEND ,
Dec 14, 2017

Copy link to clipboard

Copied

Yep, and if keeping hard drive space on the server is more important (I know some hosting services don't give that much space to client projects), you can use CFFILE action="READBINARY" to store the file in a variable, then use the variable as the content of the CFMAILPARAM.  In this case, the file is only saved to the TEMP directory, then deleted after the variable contains the binary.

HTH,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
LEGEND ,
Dec 14, 2017

Copy link to clipboard

Copied

Oh, and one more thing.  If you can be sure that the users are all going to be using the latest browsers (no more than one or two versions behind current), you can use JavaScript file to check for file size, mimetype, etc., before the file is uploaded.  If you have the form set to have JavaScript submit the form, no one will be able to upload malicious files to your application/site.  Or, at least, it would become difficult to.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
New Here ,
Dec 14, 2017

Copy link to clipboard

Copied

Thank you for your help. I'm probably less knowledgable than you think.

Below is the code I have for the form. I think I need more code, something about where the file gets stored but I'm not sure where it goes?

<cfif NOT isDefined("form.submitted")>         

  <div>

  <h2 class="fly-reservation-form-info-title">SEND US YOUR APPLICATION</h2>

  <div class="fly-reservation-form-title-divider"></div>

  </div>

  <form action="" method="post">

  <div class="control-group form-group">

  <div class="field-text">

  <label>Name:</label>

  <input type="text" class="form-control" id="pname" name="name" required data-validation-required-message="Please enter your name.">

  <p class="help-block"></p>

  </div>

  </div>

  <div class="control-group form-group">

  <div class="field-text">

  <label>Phone Number:</label>

  <input type="text" class="form-control" id="phone" name="phone" required data-validation-required-message="Please enter your phone number.">

  </div>

  </div>

  <div class="control-group form-group">

  <div class="field-text">

  <label>Email:</label>

  <input type="email" class="form-control" id="email" name="email" required data-validation-required-message="Please enter your email address.">

  </div>

  </div>

  <div class="control-group form-group">

  <div class="field-text">

  <label>Message:</label>

  <textarea rows="5" cols="100" class="form-control" id="message" name="message" required data-validation-required-message="Please enter your message" maxlength="999" style="resize:none"></textarea>

  </div>

  </div>

  <div class="control-group form-group">

  <div class="field-text">

  <label>Fiel Upload:</label>

  <input type="file" class="form-control" id="file_upload" name="file_upload">

  </div>

  </div>

  <div id="success"></div>

  <!-- For success/fail messages -->

  <button type="submit" name ="submitted" class="field-submit fly-btn fly-btn-1 fly-btn-md fly-btn-color-2 fly-btn-to-top">SEND</button>

  </form>

  <cfelse>

  <cfmail to="mark@domain.com"

  from="#FORM.email#"

  subject="Careers Application Form Submission"

  type="html">

  <span style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">

  <p>This message has been sent automatically by domain.com</p>

  <p>A user has sent the following information through the Careers Application Form.</p>

  <p><strong>Name: </strong>#FORM.name#</p>

  <p><strong>Email: </strong>#FORM.email#</p>

  <p><strong>Phone: </strong>#FORM.phone#</p>

  <p><strong>Message: </strong><br />

  #FORM.message#</p>

  <cfmailparam file="#form.file_upload#"/>

  </span>

  </cfmail>

           

  <h2 class="fly-reservation-form-info-title">THANK YOU</h2>

  <p>Your application has now been sent.</p>

  </cfif>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
LEGEND ,
Dec 14, 2017

Copy link to clipboard

Copied

<form action="" method="post"> should be:

<form action="" method="post" enctype="multipart/form-data">

Before the CFMAIL tag, you should use CFFILE to grab the file and READBINARY:

<cffile action="READBINARY" file="#form.file_upload#" variable="uploadedFile" />

<cfset filename = CFFILE.clientfile /> <!--- this is the name of the file uploaded by the user --->

<cfmailparam file="#form.file_upload#" /> should be:

<cfmailparam file="#filename#" content="#uploadedFile#" disposition="attachment" />

HTH,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
New Here ,
Dec 14, 2017

Copy link to clipboard

Copied

Thanks

Unfortunately I'm getting an 'Internal Server' error. Not sure what to do now !?!

Thank you anyway.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
LEGEND ,
Dec 14, 2017

Copy link to clipboard

Copied

There should be indications in the webserver logs, possibly in CF Admin logs, too.

Are you using IIS or Apache?

V/r,

^ _ ^

PS:  Also, you can place the whole lot of code between CFTRY/CFCATCH tags, and use <cfdump var="#cfcatch#"> inside the catch portion.  This should display on the screen precisely what the issue is.

<cftry>

{your code}

<cfcatch><cfdump var="#cfcatch#" /></cfcatch>

</cftry>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
New Here ,
Dec 15, 2017

Copy link to clipboard

Copied

Hi

Well I think it is IIS version 8.5

Not sure what web server logos are, or where they would be?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 15, 2017 0
Adobe Community Professional ,
Dec 15, 2017

Copy link to clipboard

Copied

Web server logs contain one line for every HTTP/HTTPS request. You can find the logs under C:\inetpub\logs\LogFiles\{webserverid} by default. You can find which ID belongs to which webserver in the IIS Management Console.

Dave Watts, CTO, Fig Leaf Software

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 15, 2017 0
New Here ,
Dec 18, 2017

Copy link to clipboard

Copied

Thanks for the reply. Unfortunately I don't fully understand.

erm… so C:\ I know a have one of them on my computer, though I'm on a mac and it doesn't show the drive letters, but wouldn't it go to the server were my website is live?

And I don't even know where to look for the IIS management console!!! 

Arrhhh!

Thanks
Mark

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 18, 2017 0
LEGEND ,
Dec 18, 2017

Copy link to clipboard

Copied

If you were on a Windows machine, you'd have a C:\ drive; but as you stated, you are using a Mac.  But this all assumes that you are using one computer as a WebServer, ColdFusion Server, and development server; or, at least are using your local, private network for development.

Yes, the logs are located on the WebServer, or as you put it "the server where [your] website is live".  That system will have the Management Console (if using IIS), or the Apache-equivalent if using Apache as the web server.  If that system is within a hosting service, then you can contact Tech Support and ask them to help with getting access to the logs.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 18, 2017 0
wauds LATEST
New Here ,
Dec 20, 2017

Copy link to clipboard

Copied

Thank you for all your help.

I have found another way of doing and getting it to work.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 20, 2017 0