Forum

Thread tagged as: Problem, Error, Blog

Assets not Uploading

Hello,

We've been in the process of adding a Blog to one of our clients sites using Perch Blog. After doing so, the Asset upload stopped working.

When adding perch blog, it required us to update perch to the latest version. This, in addition to running force update, did not seem to help with fixing asset uploads.

There aren't any errors on the Assets page when the upload is 'complete', and there doesn't seem to be anything wrong in the Diagnostic report. We've also made sure that the resources folder and sub-folders are writable.

Here is the short diagnostic:

    Perch: 2.8.31, PHP: 5.6.18-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
    Server OS: Linux, apache2handler
    Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_blog (5.0), perch_forms (1.7), perch_gallery (2.8), perch_members (1.1)
    App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_gallery', 'perch_members', 'perch_blog' );
    PERCH_LOGINPATH: /admin
    PERCH_PATH: /var/www/vhosts/www.oneacademy.ca/httpdocs/admin
    PERCH_CORE: /var/www/vhosts/www.oneacademy.ca/httpdocs/admin/core
    PERCH_RESFILEPATH: /var/www/vhosts/www.oneacademy.ca/httpdocs/admin/resources
    Image manipulation: GD Imagick
    PHP limits: Max upload 256M, Max POST 256M, Memory: 512M, Total max file upload: 256M
    F1: 2edba60ed1f613d6dd804feb202456a2
    Resource folder writeable: Yes
    HTTP_HOST: one.dev
    DOCUMENT_ROOT: /var/www/vhosts/www.oneacademy.ca/httpdocs
    REQUEST_URI: /admin/core/settings/diagnostics/
    SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Also, the debug after attempting upload on the Assets page:

Debug Message
[1] SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='753eb588ce3ec6b7d1c1818eb0f9d4fe' LIMIT 1
UPDATE perch2_users SET userHash='fb8a1c6ad73df80d176ad73adb784dcd' WHERE userID='1'
[43] SELECT p.privKey FROM perch2_user_privileges p
[32] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT r1.*, r2.resourceFile AS thumb, r2.resourceWidth AS thumbWidth, r2.resourceHeight AS thumbHeight, r2.resourceDensity AS thumbDensity FROM perch2_resources r1 LEFT OUTER JOIN perch2_resources r2 ON r2.resourceParentID=r1.resourceID AND r2.resourceKey='thumb' AND r2.resourceAWOL!=1 WHERE r1.resourceKey='orig' AND r1.resourceAWOL=0 ORDER BY r1.resourceUpdated DESC, r1.resourceID DESC LIMIT 0, 30
[0] SELECT FOUND_ROWS() AS `count`
[0] SELECT DISTINCT resourceType FROM perch2_resources WHERE resourceAWOL=0 AND resourceType !="" ORDER BY resourceType ASC
[0] SELECT DISTINCT resourceBucket FROM perch2_resources WHERE resourceAWOL=0 AND resourceType !=""
Queries: 9
Memory: 2.5832

If further info is needed, please let me know. Thanks in advance!

James Harrison

James Harrison 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

When you say "stopped working" what happens?

Is there an image in the resources folder at all?

Are there JavaScript errors in your console?

Are you uploading from a template, if so can we see the template?

Nothing happens; it shows the loading bar (which fills to green really quickly), the upload 'block' disappears, the page refreshes and there's nothing uploaded. This occurs when uploading both in the 'Assets' tab, and through a template.

When uploading through a template, if there's a bucket set it will create the sub-folder for the bucket in the resources folder, but doesn't create the image files.

I just tried again with the web-browser console open; and there aren't any errors. I've also checked server logs to see if anything was showing there, and it's empty.

I've also tried uploading via other templates on the site, and the same thing happens.

I am sorry. I deleted my post because I was asking nearly identical questions as Rachel. :(

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you been able to upload files to other sites on this server?

Running in our dev environment, the site runs alongside other perch sites, which have no problem uploading Assets. However, the version of Perch these other sites run (and the one I just tested to be double-sure it (an 'other' site) works) is older.

I should mention that all of our developers run a rather similar development environment locally - we've all setup this site in our own local environments, and we all encounter the same problem - assets not uploading.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have any buckets configured?

Yes, there's one in the Blog template. But I don't believe that would harm uploading on the Assets page itself; uploading doesn't work anywhere on the site.

I just tried uploading a custom logo on the settings page, and that doesn't work as well. However, at the bottom of the page, there's the following error:

Array
(
    [type] => 2
    [message] => File upload error - unable to create a temporary file
    [file] => Unknown
    [line] => 0
)

I've poked around in our conf files, etc, and was unable to find any differences between this site and our other sites that would explain why it wouldn't be able to create temp files. Ideas?

This looks like file permissions on the resources file.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

That error doesn't come from Perch, this is something in your environment. Either permissions on the tmp folder or the tmp folder is full.

Is there anything in Perch that we can check to tell us where the system was trying to write the temporary file? We have at least 3 or 4 other Perch sites running in the exact same environment at any given time, they all are working fine.

I've also updated perch on one of the other sites, to 2.8.31, and it can upload fine, so it's some sort of specific problem with this one site.

As to what's causing the issue, we can't tell as there aren't any detailed errors from the system besides the one given above. The resources folder has correct permissions - as Perch is able to create the subfolders for Buckets. The tmp folder is fine, as other sites use it at will.

I've also compared the phpinfo() of the problematic site, and the one mentioned above that I updated for comparison - there aren't any major differences; which would make sense because it's the same environment, with mostly the same settings.

Drew McLellan

Drew McLellan 2638 points
Perch Support

When the bucket folders are created, do they have the correct permissions for PHP to write to them?

Yes, the same as the resources folder.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Have you looked in your PHP error log to see if there are any further errors?

If you Google that error you'll see plenty of reports all pointing to permissions type errors so you will need to do a bit more digging around to find the reason.