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.

We've moved the forum!

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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[SOLVED] Problem Attaching Image on Custom Page from tutorial


Go to End


7 Posts   1762 Views

Avatar
Pix

Community Member, 158 Posts

10 December 2010 at 6:29pm

Hi,

I can't seem to upload an image to the "Staff" page type created in the tutorial. When I go to the "Images" tab and choose to attach an image from my computer, it does not show up in the admin or on the page. If I choose to attach something uploaded to the file store, it works. Can someone please tell me how to fix this or what I should be looking for? I'm using version 2.4.3

Thank you!

Avatar
Willr

Forum Moderator, 5523 Posts

10 December 2010 at 9:06pm

If you attach the file from your computer does it upload to the assets/ folder successfully? i.e when you use select from file system you can see your image. If it doesn't upload then a couple things to check

* Permissions on your assets/ folder. Web server needs read / write access to upload files
* Check the extension of the image is valid (eg png, gif
* Ensure the files not too big (can you upload small files?)

Avatar
Pix

Community Member, 158 Posts

11 December 2010 at 9:03am

Hi Will,

Thank you for the response! I can upload things to the assets folder from the files/images tab just fine. That's why I thought this is really weird, maybe there is a problem with my page type but I followed the tutorial word for word, maybe I missed something? I have the "images" tab in the page type, it just does not let me attach an image "from my computer". If I go to files/images and upload the image first, and then choose to attach an image "from the file store" I am fine.

Avatar
Pix

Community Member, 158 Posts

11 December 2010 at 9:26am

Edited: 11/12/2010 9:27am

p.s. I seem to have the same problem from another page type I created, a Flash page type using swfobject from this tutorial:

http://www.ssbits.com/tutorials/2009/embed-flash-content-using-swfobject/

I can't attach the SWF from my computer, but if I upload to the file store first it works. Thanks for any help or pointers...

Avatar
Pix

Community Member, 158 Posts

12 December 2010 at 9:31am

Edited: 12/12/2010 9:53am

Please, anyone know about this or have any ideas? Here is what I have for mt StaffPage code:

<?php

class StaffPage extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image'
);

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));

return $fields;
}
}

class StaffPage_Controller extends Page_Controller {

}
?>

So I get the image tab in the Admin, but it does not upload the photo or attach the image. I'd really like to get this fixed. Thank you for any suggestions.

Avatar
Pix

Community Member, 158 Posts

14 December 2010 at 6:37am

Does anyone have any idea here? I've looked but I can't really see what might be happening. At this point I would just like to know if I am doing something wrong or if it is a bug in the CMS. Is there a way for me to debug this?

Avatar
Pix

Community Member, 158 Posts

15 December 2010 at 12:37pm

This is solved and was an issue on my end. I had proper permissions on the assets folder, thus I could upload to assets from Files & Images tab, but the Uploads folder inside the assets folder did not have proper permissions. The custom page types try to upload to assets/Uploads which is why it was failing.