object - How to attach a file to a dataobject in silverstripe 3 -


I have a simple task that I can not figure out. In SS3 how can I add a file to my data object or in other words, create a file upload field, and that file can bind objects to a data object. See examples given below:

Data class = $ db = array ('Title' => 'Varchar', 'Desc' => 'Text', ' Help Text '= & Gt;' HTMLText ', //' File Upload (Document) '=>;); } // class

Note: For now I would like to file only one, but later, I want to file several files on any other object.

The file can not be set to $ db but it's in $, because it's the other databob Have a relationship.

So you will need it:

  Private is static $ _On = array ('FileUpload' = & gt; 'File');  

I do not think the spaces and brackets in the key of $ db or $$ are a good idea, because they are used for database fields. If you want to set a title for scaffolded areas, use $ fields_labels. Private file $ field_labels = array ('title' = & gt; My fancy title ',' Desc '= & gt;' description ',' has_one_FileUpload '= & gt;' file Upload (document) ');

If you want mutliple files, then you will need to define it as $ as_many $ c_mames.

See for more information.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -