Forum

Thread tagged as: Problem, Runway

Runway: Lost ability to upload files

I have several regions which accept file uploads. The strange thing is, they were all working fine on local dev, but after several weeks of content additions at staging, they've suddenly broken.

Here's one of the templates:

<h6><perch:content title="true" required="true" id="title" type="text" label="Category Title" /></h6>

<ul><perch:repeater id="product_literature" label="Literature">
    <li><a class="icon-file" target="_blank" href="<perch:content id="file" type="file" label="File" order="2" bucket="product_literature" />"><perch:content type="text" id="desc" label="Title" order="1" required="true" title="true" /><perch:content suppress="true" id="display_everywhere" type="checkbox" label="Display Everywhere" value="yes" help="If checked, item will be displayed on all product pages, as well as Product Literature section." /></a></li>
</perch:repeater></ul>

When I go to that edit page in Runway now, the file upload area is just showing a "Choose file" button instead of the asset upload lightbox link. When I try to upload a PDF that worked on local dev, I get this message at the top of the edit page:

Warning: move_uploaded_file(/var/www/public/usgear.dev/usg-admin/resources/ring_and_pinion_/dummypdf.pdf): failed to open stream: No such file or directory in /var/www/public/usgear.dev/usg-admin/core/lib/PerchUtil.class.php on line 901

Warning: move_uploaded_file(): Unable to move '/tmp/phpff62Fv' to '/var/www/public/usgear.dev/usg-admin/resources/ring_and_pinion_/dummypdf.pdf' in /var/www/public/usgear.dev/usg-admin/core/lib/PerchUtil.class.php on line 901

In config I have the following options:

    define('PERCH_PARANOID', true);
    define('PERCH_VERIFY_UPLOADS', true);

But even if I switch them both to false (or remove them), I have the same problem. This is broken now on both local dev and staging. We're supposed to launch next week, so this is somewhat urgent. Thanks for the help.

Diagnostics:

Perch Runway: 3.0.8, PHP: 5.6.14-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_forms (1.9.1)
App runtimes: <?php $apps_list = [ 'perch_forms', ];
PERCH_LOGINPATH: /usg-admin
PERCH_PATH: /var/www/public/usgear.dev/usg-admin
PERCH_CORE: /var/www/public/usgear.dev/usg-admin/core
PERCH_RESFILEPATH: /var/www/public/usgear.dev/usg-admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
HTTP_HOST: usgear.dev
DOCUMENT_ROOT: /var/www/public/usgear.dev
REQUEST_URI: /usg-admin/core/settings/diagnostics/
SCRIPT_NAME: /usg-admin/core/settings/diagnostics/index.php
Shane Lenzen

Shane Lenzen 18 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

Unable to move '/tmp/phpff62Fv' to '/var/www/public/usgear.dev/usg-admin/resources/ring_and_pinion_/dummypdf.pdf'

Whilst your resources folder is writable, it looks as if the sub-folder ring_and_pinion_ isn't writable. Check the permissions on that folder and try again.

That's another strange thing...ring_and_pinion_ doesn't exist, it looks like a truncated version of a bucket called ring_and_pinion_literature. Either way, you can see in the template that it should be using a bucket called product_literature. I'm wondering if something might have gotten screwy with the DB. Permissions are wide open on my local dev server, so that isn't a factor AFAIK.

Duncan Revell

Duncan Revell 78 points
Registered Developer

Bucket names have a max size of 16 characters.

https://docs.grabaperch.com/perch/resources/buckets/

No idea why it's looking at the wrong bucket though!

Uh oh...could that have created the problem to begin with? It was working fine for a while. Any idea what I should do to rectify the pre-existing buckets with names that are too long?

Drew McLellan

Drew McLellan 2638 points
Perch Support

How is the bucket configured in your bucket list?

It isn't, the buckets were created by adding them to templates and uploading assets through the templates.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. You'll need to keep your bucket names within the specified number of characters.

For the buckets that have already been created that are more than 16 chars, the +16 char directories are sitting in the resources folder filled with assets...what should I do to switch them to -16 char buckets? My client has already uploaded hundreds of assets.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure, as you're outside tested parameters. Have you tried shortening the bucket names?

Shortening to less than 16 characters fixed it. Luckily most of the existing bucket names were already less than 16 chars. Thanks for the help!

Side note, the buckets docs don't mention the 16 char limit in the "basic buckets" section, which might be as far as some people (me) read. The next section starts with "for more advanced use..." so I probably bailed at that point!