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

Cannot set custom folder for ImageField


Reply

17 Posts   5410 Views

Avatar
stefant42

1 April 2011 at 6:11am Community Member, 14 Posts

Silverstripe is often Buggy :

Look @ this Line 142 till 155 in File Image.php :

      $file = ASSETS_PATH . "/$class/$file";
      
      while(file_exists(BASE_PATH . "/$file")) {
         $i = $i ? ($i+1) : 2;
         $oldFile = $file;
         $file = ereg_replace('[0-9]*(\.[^.]+$)',$i . '\\1', $file);
         if($oldFile == $file && $i > 2) user_error("Couldn't fix $file with $i", E_USER_ERROR);
      }

      
if(file_exists($tmpFile['tmp_name']) && copy($tmpFile['tmp_name'], BASE_PATH . "/$file")) {
....

WTF is BASE_PATH used?