Forum

Thread tagged as: Error, Forms

Perch Form attached files not downloading from Perch

Hi,

Files uploaded through a form are not downloading when clicked on in Perch. The error I am getting is:

Array
(
    [type] => 8
    [message] => Trying to get property of non-object
    [file] => /Volumes/Data/g Websites/newgateclocks/newgate-clocks/admin/addons/apps/perch_forms/modes/response.detail.pre.php
    [line] => 20
)

This is the upload section in my form:

<perch:label for="fileupload">Please upload a CV or your portfolio (Please note we only accept PDF or Office documents)</perch:label>
        <perch:input type="file" id="fileupload" label="Upload CV" accept="pdf office richtext" bucket="job_applications" />

The link looks like this:

https://newgateclocks.dev/admin/addons/apps/perch_forms/responses/detail/?id=790&file=fileupload

The files are uploading to the specified folder fine.

This is my diagnostics:

SUMMARY INFORMATION

Perch Runway: 2.8.34, PHP: 7.0.13, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_blog (5.0), perch_forms (1.8.3), perch_shop_orders (1.0.11), perch_shop_products (1.0.11), perch_shop (1.0.11), perch_members (1.5), perch_mailchimp (3.0.1), perch_twitter (3.6.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_mailchimp', 'perch_twitter', 'perch_members', 'perch_shop', 'perch_blog' );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Volumes/Data/g Websites/newgateclocks/newgate-clocks/admin
PERCH_CORE: /Volumes/Data/g Websites/newgateclocks/newgate-clocks/admin/core
PERCH_RESFILEPATH: /Volumes/Data/g Websites/newgateclocks/newgate-clocks/admin/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
Resource folder writeable: Yes
HTTP_HOST: newgateclocks.dev
DOCUMENT_ROOT: /Volumes/Data/g Websites/newgateclocks/newgate-clocks
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Mike Harrison

Mike Harrison 37 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Not seen that one before. Does anything useful show up in debug?

Simon Clay

Simon Clay 127 points

I had the same issue: https://forum.grabaperch.com/forum/11-21-2016-2-problems-with-perch-form-with-uploads

Switching back to PHP5.6 cured it. I've not been able to detect what is different between PHP5.6 and PHP7 to cause the problem.

Thanks Simon - yes I upgraded to PHP7 yesterday so I guess that is what is causing my problems, thanks.

Yes just tested by rolling back to 5.6 and the downloads work again.

Drew, if you could help me work out what the issue is that would be great. What information would you need?

Hi Drew,

I have run a diff on the two php.ini files - there are a lot of differences and I am not sure which are relevant. This is a link to the results:

https://www.diffchecker.com/g4A8150e

If you could find the time to take a look that would be great. In addition to that in Perch these are the listed extensions in my Diagnostics, items in bold are present in one not the other:

5.6

Core, date, ereg, libxml, openssl, pcre, zlib, filter, hash, pcntl, readline, Reflection, SPL, session, standard, cgi-fcgi, bcmath, calendar, ctype, curl, dom, fileinfo, ftp, gd, iconv, imap, json, mbstring, mysqlnd, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, SimpleXML, sockets, sqlite3, tokenizer, xml, wddx, xmlreader, xmlwriter, xsl, mhash, ionCube Loader

7.0

Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, readline, Reflection, SPL, session, standard, cgi-fcgi, bcmath, calendar, ctype, curl, dom, fileinfo, ftp, gd, iconv, imap, json, mbstring, mysqlnd, PDO, Phar, posix, SimpleXML, sockets, sqlite3, tokenizer, xml, xmlwriter, xsl, mysqli, pdo_mysql, pdo_sqlite, wddx, xmlreader, Zend OPcache

The following extensions are available but not installed for PHP7.0 in my EasyApache 4 PHP Extensions manager in WHM:

  • php70-build
  • php70-libc-client-devel
  • php70-libc-client-static
  • php70-php
  • php70-php-bz2
  • php70-php-dba
  • php70-php-dbg
  • php70-php-enchant
  • php70-php-exif
  • php70-php-fpm
  • php70-php-gettext
  • php70-php-gmp
  • php70-php-intl
  • php70-php-ioncube6
  • php70-php-ldap
  • php70-php-mcrypt
  • php70-php-odbc
  • php70-php-pgsql
  • php70-php-process
  • php70-php-pspell
  • php70-php-recode
  • php70-php-snmp
  • php70-php-soap
  • php70-php-sourceguardian
  • php70-php-tidy
  • php70-php-xmlrpc
  • php70-php-zip
  • php70-scldevel

This is the debug in Perch prior to clicking the file link:

Time    Δ   Debug Message
0.0656  0   [1] SELECT u.*, r.* FROM clocks_users u, clocks_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='037f65e87143106b1e0a1a575420d5ee' LIMIT 1
0.0662  0.0006  UPDATE clocks_users SET userHash='3b6b3e2608d896ba935f514681fefa57' WHERE userID='1'
0.0664  0.0002  [81] SELECT p.privKey FROM clocks_user_privileges p
0.0691  0.0027  [41] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM clocks_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
0.1003  0.0312  [nil] SELECT collectionID, collectionKey, collectionEditRoles FROM clocks_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
0.1067  0.0064  [1] SELECT * FROM clocks_forms_responses WHERE responseID='494' LIMIT 1
0.1188  0.0121  Queries: 7
0.1189  0.0001  Memory: 1.7609

And this is it after:

Time    Δ   Debug Message
0.1338  0   [1] SELECT u.*, r.* FROM clocks_users u, clocks_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='d0c340b30ef054a4cd3f48ea8d71f36d' LIMIT 1
0.1345  0.0007  UPDATE clocks_users SET userHash='93ce21e19cd185ce9846052518da8e1a' WHERE userID='1'
0.1348  0.0003  [81] SELECT p.privKey FROM clocks_user_privileges p
0.1373  0.0025  [41] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM clocks_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
0.1691  0.0318  [nil] SELECT collectionID, collectionKey, collectionEditRoles FROM clocks_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
0.1755  0.0064  [1] SELECT * FROM clocks_forms_responses WHERE responseID='494' LIMIT 1
0.1881  0.0127  Queries: 7
0.1882  0.0001  Memory: 1.7611
0.1882  0   
Array
(
    [type] => 8
    [message] => Trying to get property of non-object
    [file] => /home/newgatedev/public_html/clocks/admin/addons/apps/perch_forms/modes/response.detail.pre.php
    [line] => 20
)

Hi Drew,

Did you have any thoughts on this? I have had no luck so far asking my hosts

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's logged to look into.

Great, thanks. If you need anything further from me please let me know