0

I've configured a channel form with the goal of receiving applications for employment. Part of this process means the user should have the ability to upload a pdf or word document to the channel.

Currently the form only accepts image uploads. If a user chooses a pdf or word doc I get an error that the file type is not accepted.

My set up is:

{exp:channel:form channel="job_application" logged_out_member_id="2" include_jquery="no" include_assets="no" json="yes" return="/contact-us/careers"}
<label for="applicant_resume">Upload your resum&eacute;</label>
<input id="applicant_resume" name="applicant_resume" type="file">
{/exp:channel:form}

Channel Field

Allowed file type: All

Allowed directory: Resumes

File Upload Preferences

  • Allowed File Types: All file types

XSS Filtering: Off

I've tried uploading as a guest, logged in as a Client, logged in as a Super Admin and no difference. Curiously, I can log into the admin area and manage pdfs, docs, etc just fine. The error only happens with Channel Form.

7
  • Have you tried turning off xss filtering? Some pdf's seem to cause issues with this. Probably not a solution for production but it would be good to see if that is the problem. Found under Security and Privacy > Security and Sessions Preferences.
    – Phil
    Dec 3, 2014 at 16:12
  • I left that out of the OP, but yes, I've disabled XSS filtering. Dec 3, 2014 at 17:00
  • Have you tried variations of the channel form parameters - like include_jquery=yes include_assets=yes json=no etc..? Dec 8, 2014 at 23:40
  • including jquery does nothing, including assets creates a bunch of errors with javascript, json removal breaks the form as it's submitted via ajax. Dec 9, 2014 at 19:34
  • What EE & what php version you use? try to debug it - open file system\expressionengine\libraries\File_field.php and add after line 271: var_dump($_FILES); die(); what do you have in "type"? it was bug in some php version with types names.
    – Max Lazar
    Dec 10, 2014 at 8:49

1 Answer 1

0
<input type="hidden" name="job_resume_directory" value="1">
<input type="hidden" name="job_resume_hidden_file" value="{job_resume}{file_name}{/job_resume}">

That was the problem. The directory value should have been set to "2"

<input type="hidden" name="job_resume_directory" value="2">
<input type="hidden" name="job_resume_hidden_file" value="{job_resume}{file_name}{/job_resume}">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.