We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Forms

Perch Forms not allowing upload of pdf or office

The form has an Upload CV field with accept="pdf office" but I get the 'filetype' error when trying to upload either of these types.

<div class="form-group">
                        Upload your CV
                        <perch:input class="form-control" type="file" id="cv" accept="pdf office" required="true" />

                        <div class="error">
                            <perch:error for="cv" type="required"><span class="error">Please attach your CV</span></perch:error>
                            <perch:error for="cv" type="filetype"><span class="error">File must be a PDF or Office document.</span></perch:error>
                            <perch:error for="cv" type="fileupload"><span class="error">Couldn't upload the file - it may be too large.</span></perch:error>
                        </div>

                    </div>

The whole form:

<perch:form id="job_application" method="post" app="perch_forms">
            <perch:input type="hidden" id="jb_titl" value="<perch:content id="job_title" type="text" label="Job Title" required="true" />" />
            <perch:input type="hidden" id="ref" value="<perch:content id="job_id" type="text" label="Job Number" required="true" />" />
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <perch:input class="form-control" type="select" options="Mr,Mrs,Miss,Master" />
                    </div>

                    <div class="form-group">
                        <div class="error">
                            <perch:error for="name" type="required">Please add your name</perch:error>
                        </div>
                        <perch:input class="form-control" type="text" id="name" required="true" label="Name" class="form-control" placeholder="First name..." />
                    </div>

                    <div class="form-group">
                        <div class="error">
                            <perch:error for="surname" type="required">Please add your surname</perch:error>
                        </div>
                        <perch:input class="form-control" type="text" id="surname" required="true" label="Surname" class="form-control" placeholder="Surname..." />
                    </div>

                    <div class="form-group">
                        <div class="error">
                            <perch:error for="email" type="required">Please add your email address</perch:error>
                            <perch:error for="email" type="format">Please check your email address</perch:error>
                        </div>
                        <perch:input class="form-control" type="email" id="email" required="true" label="Email" class="form-control" placeholder="Email..." />
                    </div>

                    <div class="checkbox">
                      <label>
                        <perch:input type="checkbox" id="permission_to_work_uk" label="Permission to work in the UK" value="yes" />
                        Please confirm you have permission to work in the UK.
                      </label>
                    </div>

                    <div class="form-group">
                        Upload your CV
                        <perch:input class="form-control" type="file" id="cv" required="true" />

                        <div class="error">
                            <perch:error for="cv" type="required"><span class="error">Please attach your CV</span></perch:error>
                            <perch:error for="cv" type="filetype"><span class="error">File must be a PDF or Office document.</span></perch:error>
                            <perch:error for="cv" type="fileupload"><span class="error">Couldn't upload the file - it may be too large.</span></perch:error>
                        </div>

                    </div>  

                    <div class="form-group hidden">
                        <perch:input class="form-control" type="text" id="type" antispam="honeypot" />
                    </div>

                    <perch:input type="submit" id="apply" value="Submit" class="btn btn-primary" />

                    <perch:success>
                        <div class="success-message">
                            <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                            Thank you, your application has been sent. We will be in touch soon.
                        </div>
                    </perch:success></p>
                </div>
            </div>
        </perch:form>

Diagnostics

PERCH INFORMATION

Perch Runway: 2.8.34
Production mode: (PERCH_DEVELOPMENT)
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), form_builder (1), perch_forms (1.8.3), perch_blog (5.0), collection_1 (2.8.34)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_blog_authors (2), perch2_blog_comments (0), perch2_blog_index (65), perch2_blog_posts (3), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (1), perch2_categories (0), perch2_category_counts (0), perch2_category_sets (1), perch2_collection_index (435), perch2_collection_items (75), perch2_collection_revisions (21), perch2_collections (2), perch2_content_index (1541), perch2_content_items (385), perch2_content_regions (80), perch2_forms (2), perch2_forms_responses (37), perch2_navigation (4), perch2_navigation_pages (23), perch2_page_routes (8), perch2_page_templates (11), perch2_pages (30), perch2_resource_log (415), perch2_resource_tags (160), perch2_resources (151), perch2_resources_to_tags (478), perch2_settings (24), perch2_user_passwords (0), perch2_user_privileges (37), perch2_user_role_privileges (30), perch2_user_roles (2), perch2_users (3)
Users: 3
PHPMailer: 5.2.21
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_forms',
        'form_builder',
        'perch_blog',
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: perchlinks, redactor, markitup
H1: 9e9fd04ff03826f1e384f762b1ea3773
L1: fa71a4809903f074254c872acf0dfb07
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
headerColour: #8ed1e3
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 0
lang: en-gb
update_2.8.34: done
headerScheme: dark
update_runway_2.8.34: done
latest_version:
on_sale_version: 3.0.9
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /perch/resources/hfh-healthcare-logo-2017.png
perch_blog_update: 5.0.1
perch_blog_post_url: /news/{postSlug}
perch_blog_site_name: HFH Healthcare
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /home/hfhcarec/public_html
PERCH_SCHEDULE_SECRET: mpeaeISmuF4vxauL
PERCH_DB_USERNAME: hfhcarec_cms
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: hfhcarec_cms
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: simon@sly-design.co.uk
PERCH_EMAIL_FROM_NAME: Simon Clay
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/hfhcarec/public_html/perch
PERCH_CORE: /home/hfhcarec/public_html/perch/core
PERCH_RESFILEPATH: /home/hfhcarec/public_html/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: Europe/London
PERCH_PRODUCTION_MODE: PERCH_DEVELOPMENT
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/hfhcarec/public_html/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.6.30
Zend: 2.6.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.6.35
Free disk space: 35.54 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, filter, ftp, gd, gettext, SPL, iconv, session, json, mbstring, mcrypt, standard, mysqlnd, mysqli, mysql, Phar, Reflection, imap, SimpleXML, sockets, exif, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, cgi-fcgi, PDO, pdo_sqlite, pdo_mysql, ionCube Loader
GD: Yes
ImageMagick: No
PHP max upload size: 50M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 8M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
CONTEXT_DOCUMENT_ROOT: /home/hfhcarec/public_html
DEFAULT_PHP_VERSION: 56
DOCUMENT_ROOT: /home/hfhcarec/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-gb
HTTP_CACHE_CONTROL: max-age=0
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: sc_is_visitor_unique=rx7647063.1503354792.1F2457AAAC2F4FCC3E690892808EB0D7.33.30.27.26.25.22.21.19.10; PHPSESSID=b5cfd53dc97d070f7e622c7b61af1cee; cmsa=1; _ga=GA1.3.2031705084.1464900375; _gid=GA1.3.2051388551.1503310924; sc_is_visitor_unique=rx7647063.1503311090.4AAF56EC37E04F068CC94B4C3B97908E.3.3.3.3.3.3.3.3.2
HTTP_HOST: www.hfhcare.co.uk
HTTP_O2GW_ID: 01
HTTP_REFERER: http://www.hfhcare.co.uk/perch/core/settings/diagnostics/
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8
HTTP_X_FORWARDED_FOR: 10.120.1.80
HTTP_X_GATEWAY: wap.london.02.net
PATH: /bin:/usr/bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 82.132.212.202
REMOTE_PORT: 17447
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/hfhcarec/public_html/perch/core/settings/diagnostics/index.php
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
SERVER_ADDR: 31.25.191.82
SERVER_ADMIN: webmaster@hfhcare.co.uk
SERVER_NAME: www.hfhcare.co.uk
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
TZ: Europe/London
UNIQUE_ID: WZvHUB8Zv1IAAAsoOscAAADG
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1503381328.38
REQUEST_TIME: 1503381328
argc: 1
Simon Clay

Simon Clay 127 points

  • 2 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Have you defined these types in filetypes.ini https://docs.grabaperch.com/templates/form/input/file/

Simon Clay

Simon Clay 127 points

I haven't defined any extra ones to the default, but I can see that these are present (amongst others):

[pdf] 
application/pdf

[office] 
application/arj
application/excel
application/mspowerpoint
application/msword

Is that right?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You might need to install the PHP file info extension to be able to correctly read the files on your server.

http://php.net/manual/en/book.fileinfo.php