aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/actions/upload.php1
-rw-r--r--mod/file/index.php3
-rw-r--r--mod/file/start.php5
-rw-r--r--mod/file/views/default/file/file.php3
-rw-r--r--mod/file/views/default/file/icon.php23
5 files changed, 33 insertions, 2 deletions
diff --git a/mod/file/actions/upload.php b/mod/file/actions/upload.php
index 881470bc7..05b0150f6 100644
--- a/mod/file/actions/upload.php
+++ b/mod/file/actions/upload.php
@@ -19,6 +19,7 @@
$prefix = "/file/";
$file = new ElggFile();
$file->setFilename($_FILES['upload']['name']);
+ $file->setMimeType($_FILES['upload']['type']);
$file->open("write");
$file->write(get_uploaded_file('upload'));
diff --git a/mod/file/index.php b/mod/file/index.php
index 577233276..896eb9e94 100644
--- a/mod/file/index.php
+++ b/mod/file/index.php
@@ -6,6 +6,9 @@
* @author Marcus Povey
* @copyright Curverider Ltd 2008
* @link http://elgg.com/
+ *
+ *
+ * TODO: File icons, download & mime types
*/
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
diff --git a/mod/file/start.php b/mod/file/start.php
index 98ee4ff46..3c5fbb80d 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -87,12 +87,13 @@
$tags = $file->getMetaData("tag");
if (!is_array($tags))
$tags = array($tags);
-
+
// Draw file
return elgg_view("file/file", array(
"tags" => $tags,
"title" => $file->title,
- "description" => $file->description
+ "description" => $file->description,
+ "mime" => $file->getMimeType()
));
}
diff --git a/mod/file/views/default/file/file.php b/mod/file/views/default/file/file.php
index 1b2beae53..cbb3034b6 100644
--- a/mod/file/views/default/file/file.php
+++ b/mod/file/views/default/file/file.php
@@ -15,12 +15,15 @@
$title = $vars['title'];
$desc = $vars['description'];
+ $mime = $vars['mimetype'];
+
?>
<div class="file">
<table width="100%">
<tr>
<td valign="top">
<div class="file_icon">
+ <?php echo elgg_view("file/icon", array("mime" => $mime)); ?>
</div>
</td>
<td valign="top">
diff --git a/mod/file/views/default/file/icon.php b/mod/file/views/default/file/icon.php
new file mode 100644
index 000000000..266a60a47
--- /dev/null
+++ b/mod/file/views/default/file/icon.php
@@ -0,0 +1,23 @@
+<?php
+ /**
+ * Elgg file icons.
+ * Displays an icon, depending on its mime type, for a file.
+ * Optionally you can specify a size.
+ *
+ * @package ElggFile
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+
+ $mime = $vars['mimetype'];
+
+ $width = $vars['width'];
+ $height = $vars['height'];
+
+ if (!$width) $width = 100;
+ if (!$height) $height = 100;
+
+ echo $mime;
+?> \ No newline at end of file