Forum

Thread tagged as: Problem

Problem with resource bucket

Hi, I have version of Perch 2.5.1 I uploaded a folder/directory inside resources named datasheets, which contains a number of files also uploaded to the server. I created buckets.php uploaded inside folder/directory config.

<?php
return array(
    'datasheets' => array(
       'web-path' => '/cms/resources/datasheets/',
       'file-path' => '/var/www/vhosts/domainName/httpsdocs/cms/resources/datasheets/'
    ),
);

The resource folder is set to permission 777 and the datasheets folder has also been set to 777. In templates/content I have the following:

 <perch:repeater id="datasheetBox" label="Data Sheets" max="40">
 <perch:before><table id="datasheet"></perch:before> 
 <tr><td><perch:content type="text" id="MSDS" label="Datasheet Name"/></td><td>
 <a href="<perch:content type="file" id="datasheet" label="Data Sheets MSDS" bucket="datasheets"/>" target="_blank" /> MSDS</a>
 </td></tr>
 <perch:after></table></perch:after>
 </perch:repeater>

So the problem I have is I can not see the bucket 'datasheets' in the cms admin and if I look at an already uploaded datasheet I see this error:

  Warning: mkdir(): Invalid path in /var/www/vhosts/domainName/httpsdocs/cms/core/lib/PerchUtil.class.php on line 846
Your resources folder is not writable. Make this folder () writable to upload files.

Yet clearly the folder is writable. Can you tell me please what I have missed as clearly other folk have it working. Many thanks

Ian Gordon

Ian Gordon 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What happens when you upload to this bucket?

Hi Drew How can I do that if I cannot see the bucket in assets all I see is the default bucket.

Drew McLellan

Drew McLellan 2638 points
Perch Support

By adding the bucket attribute to an image or file field. The bucket won't appear in the Assets app until something's been uploaded to it.

Sorry I am unclear about adding the bucket attribute... did I not do this <perch:content type="file" id="datasheet" label="Data Sheets MSDS" bucket="datasheets"/>?

Tried to upload a file still on a new page still cannot see the bucket datasheet. So if I try and upload a file to a new page I see this: Warning: mkdir(): Invalid path in /var/www/vhosts/domainName/httpsdocs/cms/core/lib/PerchUtil.class.php on line 846 Your resources folder is not writable. Make this folder () writable to upload files. Means I am unable to upload a new file. Checked the folders and permissions set to 777

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah:

<?php
return array(
    'datasheets' => array(
       'web_path' => '/cms/resources/datasheets/',
       'file_path' => '/var/www/vhosts/domainName/httpsdocs/cms/resources/datasheets/'
    ),
);

Ah.. I am lost Is the issue with the permissions? Warning: mkdir(): Invalid path in /var/www/vhosts/domainName/httpsdocs/cms/core/lib/PerchUtil.class.php on line 846

if (!file_exists($bucket['file_path'])) { $success = mkdir($bucket['file_path'], 0755, true);

Drew McLellan

Drew McLellan 2638 points
Perch Support

No - the typos. You've used file-path instead of file_path

Brilliant thanks again