Jump to:

23370 Posts in 18160 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] Problem Attaching Image on Custom Page from tutorial

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

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

Page: 1
Go to End
Author Topic: 1201 Views
  • Pix
    Avatar
    Community Member
    130 Posts

    [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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?)

  • Pix
    Avatar
    Community Member
    130 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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.

  • Pix
    Avatar
    Community Member
    130 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

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

  • Pix
    Avatar
    Community Member
    130 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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.

  • Pix
    Avatar
    Community Member
    130 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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?

  • Pix
    Avatar
    Community Member
    130 Posts

    Re: [SOLVED] Problem Attaching Image on Custom Page from tutorial Link to this post

    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.

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