17488 Posts in 4473 Topics by 1978 members
|Go to End|
7 May 2007 at 1:30pm
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!
7 May 2007 at 3:17pm
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.
7 May 2007 at 3:55pm
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.
7 May 2007 at 5:33pm Last edited: 7 May 2007 5:35pm
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.
7 May 2007 at 8:52pm
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.
9 May 2007 at 12:23pm Last edited: 9 May 2007 12:38pm
Yes, you should be able to find what you need in the "Developer Tutorials & Docs" area:
Edit: Key word there being "should". We're making our best efforts to get the API documentation fleshed out.
|Go to Top|