Hi Everybody!!!
On to a new project, so more questions!
I wish to upload banners via the ImageField('Image') class to a directory that I define, like ../assets/Uploads/Banners
How do I do this?
Thanks,
Todd
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi Everybody!!!
On to a new project, so more questions!
I wish to upload banners via the ImageField('Image') class to a directory that I define, like ../assets/Uploads/Banners
How do I do this?
Thanks,
Todd
According to the PHP IDE "Zend", ImageField has the following constructor arguments:
new ImageField(
string $name
string $title=null
int $value=null
Form $form=null
string $rightTitle=null
string $folderName='Upload'
);
Curiously enough, when I'm trying to fill out all of these fields, Zend's tooltip indicates that $form is being skipped.
Anyway, I've tried to manually set $folderName with 6 and 5 constructor arguments, and neither methodes help me to upload images to an alternative directory.
I'd be thankfull for any info about this.
It would be great if someone, anyone had some sort of answer to this question. Maybe it is an issue that isn't too important to others, but it would be very helpful to me.
Todd
It seems to work for me. For one of my sites ive got "BlogImages" saving into blogimages/ folder
new ImageField("BlogImage", "Image", null,null, null, "blogimages");
Hi Willr,
What version of Silverstripe are you using? I've tried the same thing in v. 2.2 and all it does is upload the image to the "Uploads" directory.
Todd
this is on my site running tags 2.2.1 - http://open.silverstripe.com/browser/modules/sapphire/tags/2.2.1, have to upgrade to the latest some day :P
I have no clue why it would be broken on 2.2.2 You might just need to Debug through FileField.php - The constructor for ImageField should set the folderName. Perhaps theres a bug in that. I'll have I look into this on a upcoming project.
Hi Willr,
Is there a link where I can download 2.21?
Todd
There might be a 2.2.1 zip on this site still (find the download link for 2.2.2 and change the URL to 2.2.1 and see if that works) Otherwise you will have to use subversion to checkout http://svn.silverstripe.com/silverstripe/open/modules/sapphire/tags/2.2.1