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.

Archive

Our old forums are still available as a read-only archive.

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

Uploading a pdf or some kind of non image file


Reply

11 Posts   6724 Views

Avatar
Willr

17 July 2008 at 9:50am Forum Moderator, 5511 Posts

check out the api docs for email - http://api.silverstripe.com/default/Email.html there should be a couple methods which you can call like $email->attachFile(yourfilename)

Avatar
cerelac

17 July 2008 at 8:20pm (Last edited: 17 July 2008 8:39pm), Community Member, 34 Posts

Thank you, willr.
I'll check it and see what can I do.

EDIT: Tell me one thing please. I'm trying to send and attachment with the newsletters.
Is it possible to do like that?

And one more thing, I was going to try to use attachFile, but I don't really know where should I use it (in Email class or Newsletter class).

Avatar
mlaprise

26 August 2008 at 11:45am (Last edited: 26 August 2008 11:46am), Community Member, 3 Posts

Hi everyone,

I have some problem with the FileField type. I want to have a link to a single doc file and my code is almost identical to the code of DesignCity in the third post:

class DocumentPage extends Page
{
   static $db = array(
      'Auteur' => 'Text',
      'ResumeCourt' => 'Text'
   );
   
   static $has_one = array(
      'lienDocument' => 'FileIFrameField'
   );
   
       
   function getCMSFields()
   {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab('Root.Content.Main', new TextareaField('Auteur', 'Auteur(s)'), 'Content');
      $fields->addFieldToTab('Root.Content.Main', new TextareaField('ResumeCourt', 'Resume Court'), 'Content');
      $fields->addFieldToTab('Root.Content.Document', new FileIFrameField('lienDocument', 'Selectionner votre document'));
      
      return $fields;
   }
}

class DocumentPage_Controller extends Page_Controller
{

}

When I edit the page in the admin section I get the following error message:

Fatal error: Class 'FileIFrameField ' not found in /var/www/sapphire/core/model/DataObject.php on line 921

I tried to use the FileField type instead and it seem to work. The Browse... button appear in the interface but there is no Upload button. Did I missed something ?

Thank for you help !

PS: Silverstripe is VERY nice ! By far the best CMS/platform around !