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.

Customising the CMS /

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

[Solved] Upload movies via backend


Go to End


5 Posts   1648 Views

Avatar
StefanDpunkt

Community Member, 14 Posts

15 October 2013 at 4:09am

Hi,

I want to upload movies via backend.
The films are of type "file"

    public static $ has_one = array (
      "mp4" => "File"
      "m4v" => "File"
      "ogv" => "File"
      "webm" => "File"
    );
  [/ code]
Unfortunately, I get the following error!
  
    [User Error] Uncaught Exception: Object-> __call (): the method 'fortemplate' does not exist on the 'File'
  [/ code]
I can not do anything with this error message, so, anyone has an idea?

Avatar
zenmonkey

Community Member, 545 Posts

15 October 2013 at 5:18am

Can you provide some more info, where are you getting this error? When uplaoding files, or trying to display them in the fornt end?

Avatar
StefanDpunkt

Community Member, 14 Posts

15 October 2013 at 8:17pm

Edited: 15/10/2013 8:18pm

Hallo zenmonkey,

i get this error in the front end, in the back end, i get no error. Uploading without errors.

Code Front end

<% loop Movies %>
    <div id="clip0" class="easyhtml5video" style="position:relative;max-width:640px;">
      <video id="video0" autoplay="autoplay" poster="$Startbild.Filename" style="width:100%" title="" loop="loop" onended="var v=this;setTimeout(function(){v.play()},300)">
        <source src="$webm" type="video/webm" />
        <source src="$mp4" />
        <source src="$ogv" type="video/ogg" />
        <source src="$m4v" type="video/mp4" />
        <object type="application/x-shockwave-flash" data="$Startbild.Filename" width="640" height="480" style="position:relative;">
          <param name="movie" value="../flashfox.swf" />
          <param name="allowFullScreen" value="true" />
          <param name="flashVars" value="autoplay=true&amp;controls=false&amp;fullScreenEnabled=false&amp;posterOnEnd=true&amp;loop=true&amp;poster=$Startbild.Filename&amp;src=$m4v" />
          <embed src="..flashfox.swf" width="640" height="480" style="position:relative;"  flashVars="autoplay=true&amp;controls=false&amp;fullScreenEnabled=false&amp;posterOnEnd=true&amp;loop=true&amp;poster=$Startbild.Filename&amp;src=$m4v"	allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />
          <img alt="" src="$Startbild.Filename" style="position:absolute;left:0;" width="100%" title="Video playback is not supported by your browser" />
        </object>
      </video>
  </div>
<% end_loop %>
[/end]

Avatar
zenmonkey

Community Member, 545 Posts

16 October 2013 at 1:41am

Edited: 16/10/2013 1:42am

Okay as I suspected. $webm, $ogv etc returns the file Object (the whole database record), you want to get a property off it. You'll need to use $webm.Filename. I find if the solution is video.js based you should use $webm.AbsoluteURL otherwise the falsh fallback can fail.

As an aside I would also wrap each of them in a if statement just in case the end user fails to upload one of them

<% if $webm %><source src="$webm.AbsoluteURL" type="video/webm" /><% end_if %>

Avatar
StefanDpunkt

Community Member, 14 Posts

16 October 2013 at 2:12am

It' s work!
Many, many, many THX!

!!!And I still have a bit more understood by SilverStripe!!!