Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Files & images problem


Go to End
Reply


20 Posts   2651 Views

Avatar
Webdoc

Community Member, 332 Posts

23 January 2010 at 5:09am

please help :(

Avatar
Webdoc

Community Member, 332 Posts

23 January 2010 at 5:15am

the site is braked also the security gives error:

ERROR [Warning]: sprintf() [<a href='function.sprintf'>function.sprintf</a>]: Too few arguments
IN POST /admin/security/getitem?ID=1&ajax=1
Line 1312 in /home/np29484/domains/rannamajad.ee/public_html/cms/code/CMSMain.php

Source
======
1303:
1304:      foreach($classes as $i => $class) {
1305:         $title = _t("{$class}.MENUTITLE", LeftAndMain::menu_title_for_class($class));
1306:    $perms["CMS_ACCESS_" . $class] = array(
1307:            'name' => sprintf(_t(
1308:               'CMSMain.ACCESS',
1309:               "Access to %s",
1310:               PR_MEDIUM,
1311:               "Item in permission selection identifying the admin section, with title and classname. Example:
Access to Files & Images"
* 1312:            ), $title),
1313:            'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access')
1314:         );
1315:      }
1316:      $perms["CMS_ACCESS_LeftAndMain"] = array(
1317:         'name' => _t('CMSMain.ACCESSALLINTERFACES', 'Access to all CMS sections'),
1318:         'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access'),

<ul>sprintf(Ligipääs '%s' (%s) juurde,LeftAndMain)
line 1312 of CMSMain.php

CMSMain->providePermissions()
line 499 of Permission.php

Permission::get_codes(1)
line 8 of PermissionCheckboxSetField.php

PermissionCheckboxSetField->__construct(Permissions,Permissions,Permission,GroupID,Group)
line 88 of Group.php

Group->getCMSFields()
line 61 of SecurityAdmin.php

SecurityAdmin->getEditForm(1)
line 997 of LeftAndMain.php

LeftAndMain->EditForm()
line 345 of LeftAndMain.php

LeftAndMain->getitem(SS_HTTPRequest)
line 196 of Controller.php

Controller->handleAction(SS_HTTPRequest)
line 135 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 150 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 282 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 127 of Director.php

Director::direct(/admin/security/getitem)
line 122 of main.php

</ul>

Avatar
OwenW

Community Member, 45 Posts

28 January 2010 at 11:53am

Hi Webdoc,

I have been offline for a little bit.

Did you manage to get a solution for your problems?

Cheers
Owen

Avatar
StuM

Community Member, 56 Posts

3 February 2010 at 10:32am

Edited: 03/02/2010 10:39am

I came across a weird and similar error today, I have the site running on a development server for testing which works fine and a live server which couldn't upload files, but it used to(I think it stopped working properly when upgrading to php5.2.12), although looking in my silverstripe-cache folder, the uploaded files are still sitting in there when they should have been moved rather than just copied to assets.

I made the following changes to sapphire/filesystem/Folder.php starting from line 199(function addUploadToFolder)

      if (rename($tmpFile['tmp_name'], "$base/$file")) {
         // Update with the new image
         return $this->constructChild(basename($file));
      } else {
         if(!file_exists($tmpFile['tmp_name'])) user_error("Folder::addUploadToFolder: '$tmpFile[tmp_name]' doesn't exist", E_USER_ERROR);
         else if (!is_writable(dirname("$base/$file"))) user_error("Folder::addUploadToFolder: '".dirname("$base/$file")."' is not writable by the server user", E_USER_ERROR);
         else user_error("Folder::addUploadToFolder: Couldn't copy '$tmpFile[tmp_name]' to '$base/$file'", E_USER_ERROR);
         return false;
      }

basically 2 things:

1. changed move_uploaded_file to rename
2. added else if to check whether folder is writeable

works great now, and uploaded files are moved rather than just copied.

The site is running 2.4alpha

Go to Top