23377 Posts in 18296 Topics by 2867 members
|Go to End|
22 April 2010 at 12:08pm
So I'm trying to upload images and files to specific directories ( It's a large site, just having everything into the uploads directory would be a mess in no time, and you can't be expected to upload files first then link after ), and I've having no luck..
That's my code. It's my understanding that there's a problem on the most basic level. I even tried the 2.4RC version of Upload.php with no luck.
Does anyone have a fix ? Either a custom class or fix for the current one ?
I remember trying to do the same thing with swfupload a while back and had no luck with that either, though I haven't tried this time as they are only images, but if it works now does anyone have a functional example of that ?
23 March 2011 at 3:25am
The correct code to fix this problem is:
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePagePhoto', 'Home Page Image (upload 600px width image, it will be resized properly)',NULL,NULL,NULL,'HomePagePhotos'), 'Content');
Where 'HomePagePhotos' is a directory inside assets. The path is relative to assets.
|Go to Top|