summaryrefslogtreecommitdiffstats
path: root/user_guide/helpers
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-05-05 18:39:18 +0200
committerDerek Allard <derek.allard@ellislab.com>2008-05-05 18:39:18 +0200
commit7327499064ae165468c7440f8571c3e570b58a0b (patch)
tree4f0d0053e7d25f7064c63070edcbc3af114abed9 /user_guide/helpers
parent7539f67a23c8536f892263d8d7ab9448655d8e22 (diff)
Added get_dir_file_info(), get_file_info(), and get_mime_by_extension() to the File Helper.
Changed ( ! condition) into (! condition) within the code
Diffstat (limited to 'user_guide/helpers')
-rw-r--r--user_guide/helpers/file_helper.html19
1 files changed, 14 insertions, 5 deletions
diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html
index 80063a619..af724a9d4 100644
--- a/user_guide/helpers/file_helper.html
+++ b/user_guide/helpers/file_helper.html
@@ -18,7 +18,6 @@
<meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='CodeIgniter User Guide' />
-
</head>
<body>
@@ -89,7 +88,7 @@ might not work if you are trying to access a file above the calling script.</p>
<code>
$data = 'Some file data';<br />
<br />
-if ( ! write_file('./path/to/file.php', $data))<br />
+if (! write_file('./path/to/file.php', $data))<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp; echo 'Unable to write the file';<br />
}<br />
@@ -110,8 +109,6 @@ If the file does not already exist, the directory containing it must be writable
<p class="important"><strong>Note:</strong> The path is relative to your main site index.php file, NOT your controller or view files.
CodeIgniter uses a front controller so paths are always relative to the main site index.</p>
-
-
<h2>delete_files('<var>path</var>')</h2>
<p>Deletes ALL files contained in the supplied path. Example:</p>
@@ -123,13 +120,25 @@ CodeIgniter uses a front controller so paths are always relative to the main sit
<p class="important"><strong>Note:</strong> The files must be writable or owned by the system in order to be deleted.</p>
-
<h2>get_filenames('<var>path/to/directory/</var>')</h2>
<p>Takes a server path as input and returns an array containing the names of all files contained within it. The file path
can optionally be added to the file names by setting the second parameter to TRUE.</p>
+<h2>get_dir_file_info('<var>path/to/directory/</var>')</h2>
+
+<p>Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions. Any sub-folders contained within the specified path are read as well.</p>
+
+<h2>get_file_info('<var>path/to/file</var>', <kbd>$file_information</kbd>)</h2>
+
+<p>Given a file and path, returns the name, path, size, date modified. Second parameter allows you to explicitly declare what information you want returned; options are: name, server_path, size, date, readable, writable, executable, fileperms. Returns FALSE if the file cannot be found.</p>
+
+<p class="important"><strong>Note:</strong> The &quot;writable&quot; uses the PHP function is_writable() which is known to have issues on the IIS webserver. Consider using fileperms instead, which returns information from PHP's fileperms() function.</p>
+<h2>get_mime_by_extension('<var>path/to/file/</var>')</h2>
+
+<p>Translates a file extension into a mime type based on config/mimes.php. Returns FALSE if it can't determine the type, or open the mime config file.</p>
+<p class="important"><strong>Note:</strong> This is not an accurate way of determining file mime types, and is here strictly as a convenience. It should not be used for security.</p>
</div>
<!-- END CONTENT -->