modified the security helper to assist in preventing directory traversal when using sanitize_filename() for user input
diff --git a/system/libraries/Security.php b/system/libraries/Security.php
index 9a1590b..3c1e9cf 100644
--- a/system/libraries/Security.php
+++ b/system/libraries/Security.php
@@ -680,11 +680,10 @@
 	 * @param	string
 	 * @return	string
 	 */
-	function sanitize_filename($str)
+	function sanitize_filename($str, $relative_path = FALSE)
 	{
 		$bad = array(
 						"../",
-						"./",
 						"<!--",
 						"-->",
 						"<",
@@ -701,7 +700,6 @@
 						'=',
 						';',
 						'?',
-						'/',
 						"%20",
 						"%22",
 						"%3c",		// <
@@ -717,6 +715,12 @@
 						"%3b", 		// ;
 						"%3d"		// =
 					);
+		
+		if ( ! $relative_path)
+		{
+			$bad[] = './';
+			$bad[] = '/';
+		}
 
 		return stripslashes(str_replace($bad, '', $str));
 	}
diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html
index a50d948..6d6216d 100644
--- a/user_guide/libraries/security.html
+++ b/user_guide/libraries/security.html
@@ -102,6 +102,11 @@
 
 <code>$filename = $this->security->sanitize_filename($this->input->post('filename'));</code>
 
+<p>If it is acceptable for the user input to include relative paths, e.g. <kbd>file/in/some/approved/folder.txt</kbd>, you can set the second optional parameter,
+	<samp>$relative_path</samp> to TRUE.</p>
+	
+<code>$filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE);</code>
+
 <!-- @todo write docs for CSRF methods -->
 
 </div>