Multi-user secure file storage based on Code Igniter

March 30, 2006

This is my first project using a great new lightweight PHP framework, Code Igniter.

The task was to create an online storage system that could create upload folders for multiple users and give each user a web based area to upload/download/delete files. An admin user can login to manage users and their files.

Installation instructions:

  1. Get Code Igniter installed and configured for your server.
  2. Copy the files in the system folder to your system folder.
  3. In application → config → config.php, change the following values:
     $config['sess_expiration'] = 600; //or however long you want your sessions to last
     $config['sess_use_database']	= TRUE;
     $config['sess_table_name']		= 'ci_sessions';
  4. Import ci.sql into your database and set the values in application → config → database.php accordingly.
  5. Edit the first 3 lines of application → controllers → file.php (your upload path must be writeable by the web server and should be outside of your web directory)
  6. Browse to /files and login using admin for the username and password

Let me know if you have any problems, bug fixes, etc.

Download the code.

EDIT 04/04/2006 – New release with bugfixes and some css prettying. Make sure you fix your file helper to ensure proper file deletion. Download the code.


4 Responses to “Multi-user secure file storage based on Code Igniter”

  1. Think I spotted a bug, line 381 of file.php should read:


    At the mo it reads:



  2. Pete, there’s some real nice work here. I’m finding this most handy for a little project I’m working on. My only criticism would be that the functions could be abstracted out into a library perhaps? You can create a ‘userauth’ library for all the log-in stuff and then this would become more re-usable. 🙂

  3. baumer Says:

    Yeah, I spotted that bug too, actually
    should read,
    and the file helper library should be included.

    Thanks for the feedback. I definitely agree with you on abstracting the authentication, but I was pressed for time to get it rolled out so I did it the quick and dirty way. I’m also a little unsure how to move it into a library. If you have suggestions or better yet, code, I’d love to see it.

  4. The latest version of CI includes ‘models’. you could give that a shot. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: