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

Audio File Types


Reply

6 Posts   2240 Views

Avatar
gakenny

7 May 2007 at 1:30pm Community Member, 153 Posts

Hello,

I would like to develop a site that allows audio file types to be uploaded with relevant notes, etc. Is there a working example or some notes on how this might be achieved? I am reluctant to allow uploads using HTTP as we might get timeout issues and I am wondering if the file can be uploaded and I can perform a lookup of a specified folder to link to this file via the backend interface for SilverStripe.

Thanks for any help!

Cheers,

Gary

Avatar
Jedateach

7 May 2007 at 3:17pm Forum Moderator, 227 Posts

You can upload files to the assets folder via ftp or scp. After visiting the "Files & Images" tab in the CMS, all the references to the files will automatically be stored in the database. You could then use these references to output a list on a page.

Sorry, I don't know of any working examples myself. Hope this helps.

Avatar
Jedateach

7 May 2007 at 3:55pm Forum Moderator, 227 Posts

The database stores what folder the file is in, so you make an SQL query that lists all files in a particular directory, and are of type .mp3 for example.

If you wanted to add a description for each file, I noticed that the "content" field is unused in the 'File' table...meaning you won't have to create another table to join to for adding a description.

Avatar
Jedateach

7 May 2007 at 5:33pm (Last edited: 7 May 2007 5:35pm), Forum Moderator, 227 Posts

Ok...I've since learned that the "Content" field is used for the description of the file.

From the IRC you told us that you're working on a site to contain pages of type 'seminar'. You need to be able to select a sound file to link to in the seminar page for users to download/listen to.

Within the Seminar.php file you can add a field to the $has_one array for storing the specific file you want to attach. Within the getCMSFields function, as per tutorial 2, you can add a 'TypeDropdown' field to the main tab.

You would then reference the field added to the $has_one in the Seminar.ss file to create a link to the file.

This is quite a rough description of what you can do. Please ask if you need a hand with the details.

Avatar
gakenny

7 May 2007 at 8:52pm Community Member, 153 Posts

Hi Jez,

Thanks for the heads-up... Are these field types documented somewhere?

The more I see of this tool the more I can see it's flexibility. I think I'll get the basic framework together and then work on this for v1.1.

Cheers,

Gary

Avatar
Jedateach

9 May 2007 at 12:23pm (Last edited: 9 May 2007 12:38pm), Forum Moderator, 227 Posts

Yes, you should be able to find what you need in the "Developer Tutorials & Docs" area:
http://doc.silverstripe.com/doku.php?id=all-classes

Edit: Key word there being "should". We're making our best efforts to get the API documentation fleshed out.