Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » setting uploadfolder (files, images)

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

Page: 1
Go to End
Author Topic: 1852 Views
  • yurigoul
    Avatar
    Community Member
    202 Posts

    setting uploadfolder (files, images) Link to this post

    Hi,

    am running 2.3.4 and am trying to change the default upload folder from Uploads to something else. There should be two ways to do it, and some people sugest it was broken but is fixed in 2.3.4. the only problem is that I can not get it to work.

    One option is described here: http://silverstripe.org/general-questions/show/257307#post257307 = creating a new formfield-class - for example MyImageField.php - that extends the ImageField with for example protected $folderName = 'images'; I can upload new images just fine using the new class, the only thing is that they do not go to the right folder, instead they go to 'Uploads'.

    The other is setting $folderName = 'images' or $folderName= 'assets/images/ when creating a new ImageField(). But alas, the images still uploads to 'Uploads' instead of to 'images' (and I have both created 'assets/Uploads/images and 'assets/images')

    Same goes for FileField.

    Does anyone know how to handle this?

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: setting uploadfolder (files, images) Link to this post

    Hi yurigoul,

    I had the same problem (at least with images).
    So I thought: hey it is working in SS2.4.0alpha, can't I use something of that working magic?
    And indeed, I could...

    You can download the newImageModule here.
    It's not in the extensions library, because it will become unnecessary as soon as everyone is using SS2.4.0
    Install it as any other module and call NewImageField instead of ImageField.

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: setting uploadfolder (files, images) Link to this post

    Thnx a million!

    I will try it out tomorrow!

  • dacar
    Avatar
    Community Member
    168 Posts

    Re: setting uploadfolder (files, images) Link to this post

    Hi, i tried the module with 2.3.3 but it does not work for me. Still all images into Uploads.

    Hi, i have just update one project to 2.3.4 because there were too many images in the upload folder and the backend stopped working. But with 2.3.4 the problem is still not solved. Can anybody help?

  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    Re: setting uploadfolder (files, images) Link to this post

    Another thread started here http://www.silverstripe.org/customising-the-cms/show/275888?start=0#post276833#post276833

    I did look into this as I was going to fix it in one of our sites basically the problem stemmed right down to the class 'Upload' and 'FileField' I believe and involved too much hacking of SS Core for my liking so I left it alone, from memory one of the classes has it hard coded and I couldn't for the life of me get it to override.

  • dacar
    Avatar
    Community Member
    168 Posts

    Re: setting uploadfolder (files, images) Link to this post

    hi codeguerilla,

    i have spent the whole day to fix it. no chance. Just found this: http://open.silverstripe.org/ticket/2712
    But i have tested it with no success (SS 2.3.4). The Ticket says, "loadUploaded has been deprecated for 2.3.". But in 2.3.4 it is not.

    This is really a big issue, because in one project there are more than 600 images in the uploads folder and "images and files" from the CMS does not work anymore. I hope that someone can help, please.

    Carsten.

  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    Re: setting uploadfolder (files, images) Link to this post

    I know your pain well I am happy to look into this again, from memory the problem was the $folderName in FileField is useless and the actual member variable $uploads_folder is used from Upload trying to subclass the FileField and overload $uploads_folder does nothing maybe a late static binding problem or something who knows will look into it and see what I find.

    1852 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.