Introduction

In the web application some times you need to manage your
files or allow your users to manage their files. In this time you need a file
manager and creating a powerful solution is time consuming, but you don't have enough
time. This was the story of my work when I needed it. I think if I write a
powerful file manager that is simple to use and portable, did my best.

Requirements

First step of any project get my requirements I need a file manager has this features:

Functional

Create new directory

Create new html/text file

Edit html/text files

Upload file

Upload and unzip files in to destination directory

Create Archive in server (in zip format)

Show list of Files/Directory

Show Attribute of Files

Delete files

Delete Directory

nonfunctional

Pure ASP.net (without any configuration)

Skin able (change with CSS)

User Friendly

Security

Easy to install

Using PFM (Power File Manager)

Using power file manager (in short PFM) is very simple to install. In first step copy files and directories in your web application then copy bin files to your bin directory next add link of PFM in your app.

Note:

The default directory to manage in PFM is "other file" but you can change it in source code (root path).

If you want to share the PFM with your Users for their directories you can manage root path with your app.

Now your app has one PFM.

Change Skin

To change skin of PFM you have many customizations

Change CSS in file "PFMStyle.css"

Change images in Softimages

Edit/Create Html File

PFM use MCE_tiny Editor to Create/Edit Html File. This is a powerful editor and you can change it with any Html Editor compatible with asp.net but this is not a limitation.

How to Manage Users to Use (Security)

This is simple on PFM because PFM has simple structure and you can control it by few changes in code for examples if you need change user permission to avoid deleting file, you can hide delete file in command line and so one.

This is very simple but PFM on this Article doesn't have any control on user and its sample of PFM. For making it to your interest you should change it.

Warning for multi users Use:

If you want to use it for multi users you have to change selection method. as a suggestion you can use cookie.

Create/Open Archive

To create or Open Archive I use "ICSharpCode.SharpZipLib" Library. This API is cool and is simple to work with ZIP Archive (Under GNU).

Code representation

Table Solution

My solution to show a list of files use an ASP Table, but if you know about asp table this is very simple .for this attention I wrote three classes to wrap and use easily

In this time we have Table with command bar and title bar and can add list of directory's and files

PrintList(dns, false); // dns is list of directories name
PrintList(fns, true); // fns is list of files name

Print list is a procedure with two parameters to show list in table

privatevoid PrintList(string[] fns, bool isfiles)

Other source code of create list is very easy and don't need any more comment.

Multi view Solution

In this project we have many pages to create, delete, rename and etc….
On the other hand we must create project in one page because it must be portable, in this case my idea to solve this problem is using Multiview solution.
Multiview is an ASP.net tools to create many pages in one page.

Query Handling Solution

How to handle views or user commands, when we use multi view?
To answer this question we have two choices
Event handling Or Query Handling (QH)
Event Handling is not very flexible on the other hand QH is very flexible.
QH is an old, but very powerful solution.
So, answer is QH.

Monitoring Errors

If you have a great project you will have huge errors! To solve this problem you must monitoring your errors and save them when users work with your application. Dr. Watson was a person who wrote any events. So now we have a class with this title.
DrWatson (our class) just writes thrown exceptions in a text file called "DrWatson.txt" with date/time and source of throw.

that is a good article i developed such thing in a Digital Library[^]. i used a tree and a grid in it and implemented the folders in tree and when the user selected any node ,i showed him the folder contents