Helping small companies share BIG files

by eimermusic
My pet project, called Fileshifter, is secure file-manager targeted at small companied needing to transfer big files to and from clients and coworkers. This one-man creation written in PHP using Cake has unique features such as: drag-n-drop uploads and no maximum file-size (7GB DVD image is the largest uploaded to date). Without CakePHP it would not exist.
Many of my clients are in the media industry. Productions companies, Ad agencies, Photographers, Musicians... The big problem for these, often smaller, companies is transferring work back and forth. They need to receive a logo from the client, send working files to project members, send finished work to clients for approval, things like that. I built FIleshifter to meet the needs of these people and thanks to CakePHP it was enjoyable and fast to develop.

The list of must-have features were:
  1. Simple to use for "the digitally challenged".
  2. Simple to administer for "the digitally challenged".
  3. Needs to be able to cope with large media files. (GBs not MBs)
  4. Installable on almost any web-host.
  5. Simple access control that anyone can understand.

At first glance that is quite a challenge. And at this point I had only tested CakePHP when porting my CMS from my old framework. But doing this had given me enough confidence in the system that I had no problem choosing it for this project.

Performance in FIleshifter using CakePHP

The server I run the demo and host for a few clients is seeing some remarkable traffic. Each and every request to the server invokes CakePHP. And these are the stats:


  1. Server: Pentium 3, 733mhz, 512MB RAM, 2TB SATA RAID.
  2. OS: Fedora Linux, ext3 filesystem.
  3. Data on server at the time of writing: 1.37 TB.
  4. Daily traffic: on average 28 GB.
  5. Upload / download speed: up to 9Mbit measured.
  6. Response time: 0.3-0.5 sec.

IMHO that's not too bad for a rusty old web-server. Any claims that using a RAD framework like CakePHP has performance hit is for the most part nonsense. I managed to shave 0.3sec off the request times when I re-factored a few maintenance tasks. I am very happy with these numbers and even more happy that clients can email me about a bug of a new feature and I can have that code written and published in a matter of minutes or hours and not days.


Simple GUI for "the digitally challenged".

The biggest problem in designing a simple, humane, elegant GUI is that human interaction never ever matches the database of code structure on the server. This makes it so easy to make a bad feature since it is usually easier to code. This is probably where CakePHP (and other similar frameworks I guess) shines the brightest. The solid and very modular MVC structure makes it very easy to setup and re-factor code as to let the GUI do what it wants. It was very easy to go from wanting it to work a certain way to creating a working implementation.

One example of this is the way I set up many features in Fileshifter. Since I wanted a cohesive GUI I did not want a lot of screens doing specific things. I instead created "display methods" and "action methods" in my controllers. The displays simply present the applications state. THis can be administration, browsing a project or similar. Action methods never render anything. They simply perform a task and redirects you back to the display screen. They notify the user of their success of failure through Flash messages stored in the session. To the user the result is a GUI that has buttons that "just do stuff". Another advantage is that these actions are well suited for Ajax integration even in areas that do not currently use Ajax. Note: I actively chose not to use Ajax for the main GUI. This means that users can select a file, copy the URL and email it to someone just like an web-page. The receiver clicks the link and is take directly to that file in Fileshifter (if they have access to it that is).


Coping with large files.

This was the biggest technical hurdle to overcome. I still have not seen any competing or similar product that will let users upload files that are several GB in size. The biggest file tested in FIleshifter was a 7GB DVD-image, no problem. The real limit is only the servers filesystem. An older filesystem may have a 2GB limit but any decent server can handle really big files.


Now for the secret. I cheated. There is no way you can upload a 7GB in the browser without crashing the server, browser or both. Fileshifter uses a Java-applet capable of transferring the files in a more efficient way.


The problem with big files is that the server likes to keep them in memory when sending or receiving them. To get around this, the applet reads 1MB of the file at a time and sends it to the server. PHP then takes that MB and saves it to disk. Each subsequent chunk will be appended to the file on the server. This applet also has other benefits. It can handle resumable uploads if your connection is broken. It will let you upload by drag-n-drop.

Downloading can have the same memory problem if using the simple readfile() function in PHP. The trick here is to do what the applet does. You tell PHP to read a chunk at a time. A further problem is that PHP does not send the file to the client until execution is complete... same problem... the output buffer will fill up until you are out of RAM. So not only do you need to read a chunk at a time, you also need to flush the output. These kinds of problems can keep people like me occupied for ages. Thanks to PHPs wonderful community the answers are only a few mouse-clicks away. All the gory technical stuff could be found on php.net. I quickly calmed down and got on with developing my app.

http://se.php.net/manual/en/function.readfile.php#54878
Access control and administration.

Most graphic designers, video editors, assistant copyrighters and other people working with digital media do not have a degree in computer science. Most don't know much about technical stuff like ftp or, god forbid, sftp. Most don't know how to set up a secure ACL access system. I am not complaining or trying to make these people look bad. Many of them are friends of mine. They just don't want to or need to care about these things. And why should they? Why should you need a science degree to be able to share files with your clients?


The whole structure of Fileshifter was set up for the benefit of these people. You have your projects and your files. No folders in folders or other "complicated" deep hierarchies. Administratorss have projects and users. No per-file permissions. Just access or no access on a project basis. It may be simpler to state what is not available.


  1. No hierarchies in either permissions of projects.
  2. No uploader and downloader. Just users.
  3. No checkboxes. Green light for access. Red light for no access.
  4. No user administration. Users have the power to take care of themselves.

I could go on for ages about any number of details. Instead I would encourage the reader to jump over to the public demo of Fileshifter. It will give you a feel for the application in no time.

http://engdemo.fileshifter.se

Martin Westin

Report

More on Case Studies

Advertising

Comments

  • hammettt posted on 07/20/08 11:09:30 AM
    How do you authenticate the uploads, so that you know that a 1mb file chunk is from a particular user? Also, how are the chunks sent? I'm assuming using sockets?
    • thezonie posted on 07/20/08 11:51:51 AM
      How do you authenticate the uploads, so that you know that a 1mb file chunk is from a particular user? Also, how are the chunks sent? I'm assuming using sockets? There is no concept of a "user" on http://filea.com/ (yet), but I do authenticate the file data itself to prevent any corruption or loss that may occur during transfer.

      And yes, the chunks are sent by a socket using my own protocol to get around most firewall / NAT connectivity issues.
      • hammettt posted on 07/20/08 12:16:21 PM
        There is no concept of a "user" on http://filea.com/ (yet), but I do authenticate the file data itself to prevent any corruption or loss that may occur during transfer.

        And yes, the chunks are sent by a socket using my own protocol to get around most firewall / NAT connectivity issues.
        Actually, I was referring to the original post, though I realise it was a long shot given the post is from 2006.
  • the-zonie posted on 06/24/08 08:58:01 AM
    I like what you've done with this. I'm currently developing something similar that also uses a Java Applet to do the uploading, but my solution is purely peer-to-peer, and doesn't upload anything to a server.

    It may not be right for every situation, but it's another alternative and I think it definitely has its place.

    It's basically a web site that allows you to securely share files that are too big to e-mail. There are no file or size limits, no software to download and install, and it is 100% free. It also works on all platforms, including Windows, Mac and Linux.

    The site is http://fileai.com/, and we are currently in open beta. If you happen to stop by and give it a try, we'd appreciate any feedback.

    Thanks! :)
  • Frederik posted on 12/06/06 09:43:24 AM
    This is what I meant:
    It's well hidden but check:
    http://www.fileshifter.se/en/index.html He wants 1300 euros for a license, but most of the
    job is actually done by the Java Applet which he didn't
    make but which can bought for just 80 euros from:
    http://upload.thinfile.com/resume/ Then you have 1220 euros worth of labour to get the rest
    done...

    Regards,

    Frederik
  • Frederik posted on 12/05/06 09:57:07 AM
    It's well hidden but check:
    http://www.fileshifter.se/en/index.html He wants 1300 euros for a license, but most of the
    job is actually done by the Java Applet which he didn't
    make but which can bought for just 47 pounds from:
    http://upload.thinfile.com/upload/thin.php Then you have 1250 pounds worth of labour to get the rest
    done...

    Regards,

    Frederik
  • jgreene posted on 11/06/06 12:26:56 PM
    To reference Steve's question about Flash's File Reference class:

    Flash's FileReference class does not actually handle the uploading/downloading of any files, it simply acts as a trigger for a server-side method of uploading/downloading of your choice. It is a great addition to Flash because it allows uploading and downloading to be started, stopped, and tracked through an SWF file, but it is not an uploading/downloading solution in and of itself.

    Also, the FileReference class only supports working with files 100MB and smaller.

    Very nice application, by the way.
    • Tuna posted on 12/04/06 09:34:30 PM
      ...is this application available for download anywhere? Is it open source, or if not, are licenses available?
      This app is GREAT!

      I work for a large format digital printing company, and we are constantly moving monstrous files around as well. I want to have something like this in place tomorrow...
  • walker posted on 11/06/06 11:53:58 AM
    You use javascript to fade in a "My Account" editing window. There are two ways to close the window, "Save" and "back". If the user does not want to save, they click "back". The user is not really going "back" as they are just in a little javascript fold-down window. Perhaps you could change "back" to "close" or "cancel".
    I like it. I also don't feel that you "cheated" so much as used the right technology for the job.
  • coeus posted on 11/02/06 03:50:17 PM
    I wonder, did you contemplate using Flash instead of Java for file uploading. They have a class called filereference which would be used to handle file uploads. Would it be able to handle large files as that java applet did?
  • mattisbusy posted on 10/24/06 07:24:11 AM
    I tried out your app - I like it. Feels like a nice blend between Gnome (and especially) OS X.
  • eimermusic posted on 11/30/99 12:00:00 AM
    I thought I'd add a comment to thank you all for your comments.

    The suggestion to change the label in the account-panel is right on. I use the same view for both ajax and non-ajax versions and the text was written for non-ajax where the panel is its own "page". It has been changed and will be vsible in the demo-version when I have time to update it. The demo is a bit behind the real app since it requires some locking down.

    Using Flash for upload has been answered already. I actually used the java-applet for uploads on a Flash-site last fall because it works better.

    Pricing is always tricky. Since my market is mostly in Sweden I have priced it so that I can get my money back after only a few hundred copies sold. The way Frederik puts it is a bit unfair. The cost is devided between mote than the applet and my pocket. There are costs for marketing, sales-partners want their share, legal stuff and all sorts of things.

    But ofcourse, if you only want to be able to upload files then the applet if far cheaper. It is a brilliant way to handle uploads. I also think it is unfortunate it is a java applet.

login to post a comment.