The file repository allows users to upload any kind of file. As with everything in an Elgg system, you can filter uploaded files by tag and restrict access so that they’re only visible by the people you want them to be. Each file may also have comments attached to it.
There are a number of different uses for this functionality
When a user uploads photographs or other pictures, they are automatically collated into an Elgg photo gallery that can be browsed through. Users can also see pictures that their friends have uploaded, or see pictures attached to a group. Clicking into an individual file shows a larger version of the photo.
An Elgg file repository RSS feed automatically doubles as an RSS feed, so you can subscribe to new audio content using programs like iTunes. Using the
zaudio plugin, supplied in the default Elgg package, MP3 audio files are also directly playable in the page.
It is possible for other plugins to add to the players available for different content types. It’s possible for a plugin author to embed a viewer for Word documents, for example.
Note for developers¶
To add a special content type player, create a plugin with views of the form
file/specialcontent/mime/type. For example, to create a special viewer for Word documents, you would create a view called
application/msword is the MIME-type for Word documents.
Within this view, the
ElggEntity version of the file will be referenced as
$vars['entity']. Therefore, the URL of the downloadable file is:
<?php echo $vars['url']; ?>action/file/download?file_guid=<?php echo $vars['entity']->getGUID(); ?>
Using this, it should be possible to develop most types of embeddable viewers.