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.

Customising the CMS /

setting uploadfolder (files, images)


Reply


7 Posts   1942 Views

Avatar
yurigoul

Community Member, 202 Posts

4 January 2010 at 2:40am

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?

Avatar
theAlien

Community Member, 131 Posts

11 January 2010 at 9:32am

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 [url=http://www.silverstripe.org/general-questions/show/257307?start=8]here[/url].
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.

Avatar
yurigoul

Community Member, 202 Posts

11 January 2010 at 9:56am

Thnx a million!

I will try it out tomorrow!

Avatar
dacar

Community Member, 168 Posts

15 January 2010 at 4:19am

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?

Avatar
CodeGuerrilla

Community Member, 105 Posts

15 January 2010 at 12:21pm

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

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.

Avatar
dacar

Community Member, 168 Posts

15 January 2010 at 1:22pm

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.

Avatar
CodeGuerrilla

Community Member, 105 Posts

15 January 2010 at 1:29pm

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.