MooTools based FileManager (1.0RC2)

filed under MooTools, posted on 29th April 2009 by Chris, 74 comments

I am not the guy who writes articles every other day, but fear not: I am planning to post further interesting Blogposts in the near future. For now, here is probably the biggest Script I've released as open-source: A MooTools based File-Manager for the web that allows you to (pre)view, upload and modify files and folders via the browser.


 

MooTools FileManager

Features

  • Browse through Files and Folders on your Server
  • Rename, Delete, Move (Drag&Drop), Copy (Drag + hold CTRL) and Download Files
  • View detailed Previews of Images, Text-Files, Compressed-Files or Audio Content
  • Nice User Interface ;)
  • Upload Files via FancyUpload (integrated Feature)
  • Option to automatically resize big Images when uploading
  • Use it to select a File anywhere you need to specify one inside your Application's Backend
  • Use as a FileManager in TinyMCE
  • Provides your Client with the most possible convenience ( ;D )

Demos

Download

 

Integrate into your Application

The demos in the package provide a great overview on how to implement the FileManager. I have also packed two YUI-Compressed versions. One with every module + the English language file and another version containing all modules except the Uploader part.

 

Implementing the FileManager is really simple (once you added the CSS and JavaScript):

var manager = new FileManager({
  url: 'manager.php',
  assetBasePath: '../Assets',
  language: 'en',
  uploadAuthData: {session: 'MySessionId'}
});
$('example1').addEvent('click', manager.show.bind(manager));

 

The PHP-Code to implement the FileManager:

<?php
include('../Backend/FileManager.php');
$browser = new FileManager(array(
  'directory' => 'Files/',
  'assetBasePath' => '../Assets',
  'upload' => true,
  'destroy' => true,
));
$browser->fireEvent(!empty($_GET['event']) ? $_GET['event'] : null);

 

For more configuration options on either the client- or server-side please have a look at the Backend/FileManager.php file or the Source/FileManager.js file

 

Open Source

The FileManager is released under the MIT-License so I hope you have fun with it and you can get a great use out of it. Please, if you have space on your uber-cool Web-Application to add an acknowledgement and a link back to my Portfolio, I'd appreciate it a lot

 

Any subsequent releases until the 1.0 version of the FileManager will be "drop-in"-releases. This means no update will require you to change any line of your code.

 

If you want to help improve this FileManager, fix bugs, write documentation, write code for a backend in another language or simply implement features contact me, have a look at the Project on GitHub and fork me:

 

Browser Compatibility

The Script has been tested in Firefox 3+, Safari 4, Opera and IE6+. As this is an "RC" I expect it to have some minor glitches in some browsers (namely IE). There is no PNGfix whatsoever provided so if you desperately need one please implement it yourself. There is no warranty that the excessive use of the Uploader will crash your little Internet Explorer for no reason.

 

Acknowledgements

  • This Script is loosely (!) based on a Filebrowser by Yannick Croissant: Brooser
  • The FileManager makes use of the soon to be released FancyUpload 3.0 by Harald Kirschner. Thank you for your efforts, Harald!

The Uploader.js and the FancyUpload files are "drop-ins". Just add the ‹script /›-Tags to include the files and the upload button in the FileManager-Menu will appear. Please note that the Uploader integration will require MooTools 1.2.2 as the Class-System prior to it had some shortcomings.

 

Changes from 1.0RC1 to 1.0RC2

  • There are now 8 Languages available for the FileManager: English, Spanish, French, German, Swedish, Finnish, Czech and Danish
  • FancyUpload update, changed so it is possible to upload duplicates and some adjustments for the error messages when Flash is not available
  • Adding a "hideOnClick" option to close the FileManager when the overlay is clicked
  • You can now press enter in the input fields in the Rename/Create Dialogs and you can close any dialog by pressing the ESC-Key.
  • Resetting the headline (h1) style so it doesn't destroy the style of the FileManager.
  • Minor fixes in the back end

Leave a comment

74 comments on MooTools based FileManager (1.0RC2)

syn4k posted on 4th February 2010

I got it sorted out. It just so happened that I was loading the js out of order.

I have a new issue though.
For now, I have hacked the code to solve the issue...

plugins/filemanager/Source/FileManager.js was hacked to remove the download feature since it is broken in all browsers
I simply commented out:
//if(file.mime!='text/directory')
//icons.push(new Asset.image(this.options.assetBasePath+'disk.png', {title: this.language.download}).addClass('browser-icon').addEvent('click', (function(e){
//e.stop();
//window.open(this.normalize(this.Directory+'/'+file.name));
//}).bind(this)).inject(el, 'top'));

plugins/filemanager/FileManager.php was hacked to remove the download feature since it is broken in all browsers
echo json_encode(array(
'content' => $content ? $content : '<div class="margin">
${nopreview}<br/><button value="'.$url.'">${download}</button>
</div>',
));
became:
echo json_encode(array(
'content' => $content ? $content : '<div class="margin">
${nopreview}
</div>',
));

syn4k posted on 3rd February 2010

In Uploader.js, it is failing at:
click: function(){
return false;
},

I know this because I added an alert here and it echoed back to the browser. How do I get this fixed?

My manager.php:
<?php

include('../plugins/filemanager/FileManager.php');

$browser = new FileManager(array(
'directory' => '../files',
'assetBasePath' => './Assets',
'upload' => TRUE,
'destroy' => TRUE,
));

$browser->fireEvent(!empty($_GET['event']) ? $_GET['event'] : null);

dungkhung posted on 7th January 2010

how to use it with asp.net (C#) Thanks!

beazleybub posted on 29th December 2009

Thank you for sharing :)

When uploading a large file say 100MB the upload progress bar doesn't really give an accurate idea of how much has been completed. But if you place your mouse cursor over the progress bar you see something like 72% etc.. Is there any way to place a numerical representation of the upload progress on the page?

Thanks for your great script! I have tried over fifty+ file manager scripts and none come close to being what yours is.

schmooser posted on 3rd December 2009

Have a provlem with Google Chrome 3.0.195.33 and above — "close button" and "image control buttons" doesn't displayed (but still working while hovering on them).

pete posted on 27th November 2009

I can't get the download urls to work, I am using /students/upload in order for students to upload files in the /students/ directories, but all the time it shows the upload in the url. any way to fix it? I got the preview to work using the method provided in the comments but now the download url.

fletch posted on 6th November 2009

Very awesome tool, do you have a date that you think the 1.0 release is going to happen? I am implementing this and dont want to do it twice.

Thanks

Foxy posted on 2nd November 2009

Hello,

First i wanna thank you Moo tools for their great work,it's an awesome handy tool.

In local i used it with Tiny mce,all works fine,but when i uploaded it to my webserver,i got this error: "You had to install Adobe flash to upload files" despite i've Flash player installed!

Can anyone help me on this issue please.

For information: My website is on a free web host 000webhost Unix servers.

Regards,
Foxy

Raphael posted on 2nd November 2009

Hi Chris,

This plugin is absolutely awesome.

It works on my Localhost, but when I upload it in my webserver, it doesn't work.

My localhost => php 5.3.0
My webserver => php 5.2.0

In php 5.2.x, the finfo_open function doesn't exist. Do to think that it is the problem ?

Regards,

Chris posted on 2nd November 2009

Hey all, just fyi I'm soon going to release the final 1.0 version with a whole lot more features ;)

Whipster posted on 14th October 2009

Hi Chris,

absolutely awesome file manager man.. I well appreciate it.

However, I run into a problem uploading files with a .JPG extension... any ideas? "The uploaded file has an unknown or forbidden file extension." - I've been searching all over the JS stuff to try and find where I can add support for it... but to no avail.

anayways, regardless - this is brilliant, thankyou!

Buja posted on 13th October 2009

Hi! Thnx for this great file manager. I've only one question: My upload button is not working in TinyMCE, the upload button is working without TinyMCE, how come?

thnx

magic77 posted on 12th October 2009

Hi,

is it possible to deliver a userid to the manager.php like this

$browser_moo = new FileManager(array(
'directory' => '../images/user/'.$cUID.'/',
'assetBasePath' => '../includes/mootools/FileManager/Assets',
'upload' => true,
'destroy' => true,
'maxUploadSize' => 1024*1024*32,
'safe' => true,
'filter' => 'image/'
));

where $cUID is set up in js

var manager = new FileManager({
url: 'filemanager_mootools.php?cUID=17828',
assetBasePath: '../includes/mootools/FileManager/Assets',
language: 'de',
selectable: true,
uploadAuthData: {session: '{/literal}{$central_user_id}{literal}'},
onComplete: complete
});
$('fm_button').addEvent('click', manager.show.bind(manager));

but this doesn´t work

minovec posted on 5th October 2009

Hi, I need urgend help.

Standart implementation of filemanager is:

var manager = new FileManager({
url: 'manager.php',
assetBasePath: '../Assets',
language: 'en',
uploadAuthData: {session: 'MySessionId'}
});
$('example1').addEvent('click', manager.show.bind(manager));

BUT I need run filemanager from clasical onlick as example:

<a href="#" onclick="show_manager()">Show file manager</a>

Its possible? any help?

Bruno posted on 30th September 2009

Hi Chris,

relayClick did not work for me in the latest from github(is never called on directory-click and for files it works only if I change
.store('block', true) to .store('block', false) in function revert ).
I copied the old code:
this.browser = ...............inject(this.el);
from rc2 and seems to work.
5 http://cpojer.net/blog/MooTools_based_FileManager_1_0RC2#comments 15
Page 1 of 5
Styx PHP Framework Contact Follow me on Twitter