Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » [SOLVED] Synced my files.. select, save -> 404

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 542 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    [SOLVED] Synced my files.. select, save -> 404 Link to this post

    Hello,

    I'm using DOM's all over my site and it is working for files, images, audio etc..

    Now i want to use it for video's. Grabbed the code from the example topic:

    <?php
    class VideoPage extends Page
    {
       static $has_many = array (
          'Videos' => 'Video'
       );
       
       public function getCMSFields()
       {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Videos2", new FileDataObjectManager(
             $this,
             'Videos',
             'Video',
             'Video',
             array('Title' => 'Title', 'Description' => 'Description'),
             new FieldSet(
                new TextField('Title'),
                new TextareaField('Description')
             )
          ));
          return $fields;
       }
    }

    class VideoPage_Controller extends Page_Controller
    {

    }

    ?>

    <?php

    class Video extends DataObject
    {
       static $db = array (
          'Title' => 'Varchar(100)',
          'Description' => 'Text'
       );
       
       static $has_one = array (
          // Make sure this comes first
          'VideoPage' => 'VideoPage',
    /**
    * This relationship could be as simple as 'Video' => 'File' provided
    * FileDataObjectManager::$upgrade_video is true (defaults to true).
    * However, if we know the page will only contain videos, we can simplify things by
    * using a direct relationship to FLV. This will give us the benefit of not having
    * to worry about the allowed_file_types setting.
    *
    * To make this an audio resource, set the relationship to the MP3 class, e.g.
    * 'AudioFile' => 'MP3'. Audio files are also subject to automatic upgrades, however,
    * based on FileDataObjectManager::$upgrade_audio. (true by default).
    *
    */
          'Video' => 'FLV'
       );
       
    }

    Now, i've uploaded my files movie.mov & movie.flv to the assets folder via FTP. Went to the sync (dev/tasks) and synced it..
    I go to VideoPage, tab Video2, upload, choose existing file, selected the movie.flv.. clicked save..

    it loads.. you see the square appear, but no icon is in it!

    When i Check Firebug, it says:

    "NetworkError: 404 Not Found - http://www.mydomain.com/1137"

    What is wrong here?
    Why isn't it finding my file? They are truely there, i can go the the direct link and download them.

    It is shared hosting, the server is running on windows i believe. Through the admin panel I've set-up the 'rights' on all assets- and sub folders.

  • UncleCheese
    Avatar
    4085 Posts

    Re: [SOLVED] Synced my files.. select, save -> 404 Link to this post

    Because you uploaded them with FTP, they were all assigned a ClassName of "File." Your DOM is looking for files with ClassName "FLV" so those relationships are all broken.

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [SOLVED] Synced my files.. select, save -> 404 Link to this post

    Hi cheese, thanks for your reply! That makes sense, i can't upload them directly with the DOM, because of the file size. I get Filesize errors above 10mb. I guess this is a hosting setting? they aren't so cooperative, so im guessing i will have to deal with this..

    what do you recommend? change the FLV to FILE? and use the template to control the file as a video?

  • UncleCheese
    Avatar
    4085 Posts

    Re: [SOLVED] Synced my files.. select, save -> 404 Link to this post

    I would just update the database afterwards and set all the new files to ClassName = 'FLV'

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [SOLVED] Synced my files.. select, save -> 404 Link to this post

    Hi Cheese,
    Well, i think thats difficult, because my client uploads the file through FTP, but doesn't enter phpMyAdmin. Is there another way? Like a script to update the database, relation from FILE to FLV?

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [SOLVED] Synced my files.. select, save -> 404 Link to this post

    Solved it. Upload movie via FTP, Sync files, add movie to DOM from the assets folder. Relation of the movie is FILE.
    Use template to control the $File.URL and use JWPlayer to get a nice FLV player.

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