Today, I had reasons for needing a file manager on one of the web sites that I maintain. The requirements on the file manager were as follows:
- To enable upload and download of files from/to the hard drive of the client.
- To enable deletion and renaming of files on the web server.
- To enable folder creation and deletion on the web server.
After some research using a popular search engine, I ended up downloading the PHP application FileManager. This is a PHP class that uses AJAX techniques for communication between the client and the web server.
A quote from the readme file in the distribution:
Use this software to manage files and directories on your webserver or on an FTP server. You can create, rename and delete directories, upload, download, edit, rename, delete and search files, and change file and directory permissions
So, it seemed as though all the requirements should be fulfilled using FileManager. Installation was relatively easy:
- Unzip an archive and copy the contents to some location on the web server.
- Configure the default behavior of the FileManager class using a config file.
- Set some directory permissions.
- Edit the page or pages where you want to have the functionality, include the FileManager.php class and create an instance of it. Make sure that you don't prematurely change the header information sent by PHP before you create a FileManager instance.
Objects of the FileManager class can be instantiated with an argument specifying the root folder of the hierarchy that you want to publish. In this way, it is relatively easy to have various root's depending on who is calling the PHP script.
I did came across one obstacle with the FileManager. I was using a specialized session handler on the web site that did not function well in cooperating with the FileManager's use of session cookies. So, I had to skip the special session handler and use the default one for the pages including the FileManager functionality. This was not a big loss since they could be nicely integrated into IFRAME's and using the normal session handling used for the rest of site was not needed.
I would recommend using the FileManager class for anybody with the same requirements as specified above.
0 kommentarer:
Post a Comment