Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Set chmod of folders automatically in assets/Uploads

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

Page: 1
Go to End
Author Topic: 259 Views
  • Bereusei
    Avatar
    Community Member
    94 Posts

    Set chmod of folders automatically in assets/Uploads Link to this post

    Hey guys,

    I´m using this code...

    $CategoryTitle = $this->Categories()->First()->Title;
    $CategoryTitle = preg_replace('/[^A-Za-z0-9]+/','-',$CategoryTitle);
    $CategoryTitle = preg_replace('/-+/','-',$CategoryTitle);
    $uploadField->setFolderName('Uploads/Products/' . $CategoryTitle);


    ...to create folders with the name of current category, so I automatically get a nice organized structure.

    The problem is that the folders, that the system created, gets chmod 755 and I get a permission-denied-error.
    To fix this, I must set chmod from the folder and all other folders & files in this folder to 777 by hand.

    Any idea where php-function "mkdir" sit to manage chmod or are there any other suggestions to set permission from all things in the Upload-directory to 777 automatically?

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Set chmod of folders automatically in assets/Uploads Link to this post

    why dont you try giving making the chown to the webserver user (_www) ? i think thats will be better rather than making assets folder 777

    259 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.