My AJAX File Uploader has turned out to be an awesome project.  As previously reported, on its first day it received 6000 unique visitors, and now 2 months later it’s still getting about 150 per day.

By popular request, I’ve added a bunch of new features since the initial launch, like support for multi-file uploads and e-mail notification of new uploads.

I end up spending quite a bit of time developing it, so although I give it away for free for personal use, I now charge a license fee of $89 for commercial use.  That’s worked out pretty well, and pretty much everyone who’s bought it has been fairly gushing about how happy they are with it.

I also have a couple clients who found the uploader one way or another, and then got in touch with me to ask about a customized version of it for their website.  So that’s brought in some business as well.  It’s been really interesting to watch this project, born strictly out of necessity and given away for free, turn into something that generates revenue for the business.

I’m currently trying to code my way around one irritating issue that some people are having with it, though.  [Update: it turned out to be an issue only on these few particular machines, and there was nothing that this script (or any script) could do to get around it.]  The whole premise of the script is that when you upload a file to a website through it, it shows you a progress bar and how much time is left before the upload is complete.  This requires that the server logs how much data has been uploaded so far, writing this data to a file or database and updating it about once per second during the course of the upload.  Then the user’s browser sends a request to the server about once per second to ask for the data from the log: how much has been sent so far?  How ’bout now?  OK, what about now?  Over and over.

The problem is that on some servers, the system is configured to do write-caching, so that when a program saves a file, it doesn’t actually get written to the hard disk right away.  Instead it’s kept in memory (RAM) until some predefined time limit has passed (say 5 minutes), and then when that time comes the server does a sync, writing all the cached data from memory to the hard disk.

Such write-caching is done to increase the server’s performance -- writing to memory is many times faster than writing to disk -- and it’s very common.  For example, that’s the reason it’s bad to turn off your computer using its power button without doing a shut-down first: some of the files that have been created/changed/saved aren’t actually really saved yet, and they won’t get saved until the next sync, which you might prevent from ever happening if you pull the plug without shutting down.

So how do you get two processes to communicate if you can’t use files to share data?  You use IPC, of course.  But InterProcess Communication has a tendency to take something simple and make it really complicated really quickly.  Once your program has to fork() a server and accept socket communication from the client and try not to bother the actual business of the upload too much, it starts getting hairy.

So I’m taking a little break to remind you that Day 5 (aka Season 5) of 24 starts tonight!  The season premiere is 4 hours, with the first 2 starting at 8 PM Eastern on Fox.  24 is one of the best things in life -- and I loathe most TV, so that’s got to tell you something -- and I’m so psyched.

Posted by Anthony on 1 reply


01. Jan 17, 2006 at 09:46pm by theMom:

It’s nice to see John Paul in the credits for this :)  Such a nice boy; you know, one of my favorites of your friends.  Although, actually, all of your friends were my favorites, more or less.....well since all of you never gave me any trouble.  At least none that you let me know about; praise the Lord!  Anyway, it’s very exciting about this project taking off.  Who knew?

Reply to this message here:

Your name
Website (optional)

HomeCreate PostArchivesLoginCMS by Encodable ]