Title: Image/File Manager
Last modified: January 25, 2017

---

# Image/File Manager

 *  [adamthedog](https://wordpress.org/support/users/adamthedog/)
 * (@adamthedog)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/)
 * The following code allows a user to manage the files they have uploaded via the
   upload feature. It modifies one file, and creates another. There is an “image
   preview” option that is currently only available for Internet Explorer users.
   If you wish to implement it, uncomment line 46 and comment line 44 in filemanage.
   php (below). Note that any ASCII escape strings should be corrected before implementing
   the code. If someone knows how to correctly post backslashes, PLEASE let me know.
   
   Add file: **/wordpress_directory/wp-admin/filemanage.php** `<?php require_once('../
   wp-includes/wp-l10n.php'); $title = 'Manage Images or Files'; require_once('admin-
   header.php'); if ($user_level == 0) //Checks to see if user has logged in die(
   __("Cheatin' uh ?")); if (!get_settings('use_fileupload')) //Checks if file upload
   is enabled in the config die (__("The admin disabled this function")); //$allowed_types
   = explode(' ', trim(strtolower(get_settings('fileupload_allowedtypes')))); echo("
   <div id=\"imagePreview\" style=\"position: absolute; border: 1px solid #000000;
   width: 100px; visibility: hidden; overflow: hidden; height: 100px\"></div>");
   echo("<div class=\"wrap\">"); echo("Below is a list of uploaded files. Right 
   click the file you wish to use in your post and click \"Copy Link to Clipboard\",
   then paste the link into your post.<br/>"); $dir = get_settings('fileupload_realpath');//
   Deletes the file if asked if($_REQUEST['action'] == "delete" && file_exists("
   $dir/". $_REQUEST['file'])) { $result = mysql_query("SELECT ID FROM " . $table_prefix."
   posts WHERE post_content LIKE '%" . $_REQUEST['file'] . "%' "); if(!mysql_fetch_assoc(
   $result)) { unlink("$dir/". $_REQUEST['file']); } } echo("<table border=\"0\"
   >\n<tr>\n<td>**File**</td>\n<td>**Size**</td>\n<td>**Delete**</td>\n</tr>"); 
   if (is_dir($dir)) { if($dh = opendir($dir)) { $i = 1; while (($file = readdir(
   $dh)) !== false) { if($file != "." && $file != "..") { echo("<tr>\n<td>\n"); 
   $result = mysql_query("SELECT ID FROM " . $table_prefix . "posts WHERE post_content
   LIKE '%" . $file . "%' "); $files[] = $i; list($width,$height,$type,$attr) = 
   getimagesize("$dir/$file"); $thumbHeight = 100; $thumbWidth = round(( $thumbHeight*
   $width ) / $height); echo("[" . get_settings('fileupload_url') . $file . "](https://wordpress.org/support/topic/imagefile-manager/\""?output_format=md)
   </td><td>$width x $height</td><td><span id=\"cell$i\"/>"); // Comment the above
   line and uncomment the line below for Image Previews. //echo("['\" onMouseout=\"imagePreview.innerHTML='';imagePreview.style.visibility='hidden'\">" . get_settings('fileupload_url') . $file . "](https://wordpress.org/support/topic/imagefile-manager/\""?output_format=md)
   </td><td>$width x $height</td><td><span id=\"cell$i\"/>"); if(mysql_fetch_assoc(
   $result)) echo("File in use"); else echo("[Delete](https://wordpress.org/support/topic/imagefile-manager/\""?output_format=md)");
   echo("</td>\n</tr>\n"); $i++; } } closedir($dh); } } echo("</table>"); if (!is_writable(
   get_settings('fileupload_realpath'))) $action = 'not-writable'; echo("</div>");
   include('admin-footer.php'); ?>  Modify the file **/wordpress_directory/wp-admin/
   menu.php** Add a new line, after 19, roughly: array(__('Files'), get_settings('
   fileupload_minlevel'), 'filemanage.php'),

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Tim Griffin](https://wordpress.org/support/users/tgriff/)
 * (@tgriff)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-67888)
 * Say, this could be great!
    I get the following error when trying to access this
   way cool feature: Parse error: parse error, unexpected T_STRING in /home/griffhome/
   www/www/wp-admin/filemanage.php on line 15
 *  [ringmaster](https://wordpress.org/support/users/ringmaster/)
 * (@ringmaster)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-68048)
 * It looks like the forum borked his backslashes. Change all of the `\`s to backslashes.
 *  Thread Starter [adamthedog](https://wordpress.org/support/users/adamthedog/)
 * (@adamthedog)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-68139)
 * That’s right–I couldn’t figure out how to make the backslashes work.
 *  Thread Starter [adamthedog](https://wordpress.org/support/users/adamthedog/)
 * (@adamthedog)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-68349)
 * I can’t figure out how to post the code. If anyone needs it, email me, and I 
   will send it to you.
 *  [blogbuster](https://wordpress.org/support/users/blogbuster/)
 * (@blogbuster)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-68386)
 * easy! open word pad.. paste your text copy again and paste DONE!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Image/File Manager’ is closed to new replies.

 * 5 replies
 * 4 participants
 * Last reply from: [blogbuster](https://wordpress.org/support/users/blogbuster/)
 * Last activity: [21 years, 10 months ago](https://wordpress.org/support/topic/imagefile-manager/#post-68386)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
