AJAX-y Goodness For You

A week ago when John Paul wanted to send me the video clip from my bachelor hike, we had some trouble: the file was about 19 megabytes, far too big for Gmail’s 10MB attachment limit.  We tried to send it through instant messenger, but as is often the case, one or both of our firewalls prevented that from working properly.

The easiest solution was for me to write up a quick CGI script so he could upload it to my website, from which I could then download it.

But uploading a 19MB file on a slow DSL connection takes a long time; it took almost an hour, and about 20 minutes in, John Paul was asking me, "ah... is it going?  my browser is just sitting here..."  It uploaded fine, but many an impatient (i.e. normal) internet user would have assumed it wasn’t working about a half-hour into it, and closed the window.

So I decided to whip up a little AJAX goodness and have the upload page show a progress bar and an ETA for file uploads.  The result is the Encodable Industries AJAX File Uploader, which you can try out right here.  You can also download the script to use on your own website by visiting its homepage over on Encodable.com.

Posted by Anthony on 6 replies

Comments:

01. Oct 19, 2005 at 10:11am by Kev:

Very Cool! Nice work, the demo works very well. FYI, I uploaded the windows GTK-runtime file, if you don’t already log it. I’m going to check out your source code, since I’ve been wondering what AJAX looks like in code form. It seems to be the latest coding craze sweeping the nation. As far as I know, GMail uses AJAX tech. Also Round Cube Webmail uses it as far as I know.

02. Oct 19, 2005 at 01:22pm by Kev:

I got it up and running on RedHat Enterprise Linux version 4 and it works well. Following your instructions, it did not work right away. To make it easy for anyone who’d like to run this great utility on RHEL4 (or Fedora I would guess, but have not tested), here’s what to change in apache’s configuration file, httpd.conf:

1. Fix up the Document Root paths to the cgi-bin directory:

Change: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

To: ScriptAlias /cgi-bin/ "/var/www/html/cgi-bin/"

Change:

To:

2. Uncomment the cgi Handler:

Change: #AddHandler cgi-script .cgi

To: AddHandler cgi-script .cgi

3. There is no number 3. :)

I hope someone finds this useful, and thanks again Anthony for the great uploader!

03. Oct 19, 2005 at 01:40pm by Anthony:

Hm, that’s strange.  Looks like a bug in RHEL’s default setup: their httpd.conf doesn’t match their directory structure.  Thanks for posting the fix.

Fortunately, on any server that already has CGI scripts running successfully, no such re-configuration is needed.

04. Oct 19, 2005 at 02:08pm by Kev:

Regarding the fix: no problem. I should have made it clear in my previous comment that I followed your directions first and then did the steps that I outlined. I agree with you that a system that has cgi scripts functioning properly will not need my add-on fix; possibly just a few path tweaks.

05. Oct 19, 2005 at 07:59pm by Tasha Moyer:

yep, I tried it, too. It, er, works great!

06. Oct 20, 2005 at 03:38pm by Anthony:

: )

There is now a new version online, with some new features:

a login system so you can password-protect the ability to upload files, and/or the ability to view the list of uploaded files

when logged in with the admin password, you can delete uploads through the browser

still a single script for easy installation  : )

Go get it!

Reply to this message here:

Your name
Email
Website (optional)
Subject
search posts:

HomeCreate PostArchivesLoginCMS by Encodable