If you build web sites long enough, you’ll find someone who wants to upload stuff via a web form. And then eventually you’re going to find someone who wants to upload BIG stuff. In this day and age of podcasting and video-casting, it’s becoming a lot more common.

One of the problems for me is that I generally code sites with PHP, and PHP has built in things to prevent scripts from killing the server. Things like limiting the size of uploads, and the amount of time a script is allowed to run. This isn’t really a problem when uploading pictures, even really big ones, but it can kill an hour long podcast quite quickly.

For a recent job, I had to make large uploads work. After a brief consult with a Smart Man, I found a great script called tesUpload that combines perl, javascript, and php. It can be part of a larger form, and offers a progress bar.

While digging around in the forums however, I found a post with a hacked version that offers more functionality, that I would consider essential.

I haven’t fully implemented it yet, but I got it installed and uploaded a 15M file. It’s slightly ugly, but I’ve heard those “Cascading Style Sheets” are pretty cool. It took a tiny bit of work, mostly getting paths worked out. I’m not sure it would work on dreamhost, it uses fopen, which is disabled there. But it could probably be hacked to work.

All in all, it looks quite cool.

4 thoughts on “Uploading big files

  1. Very cool. Alternatively, couldn’t you create a php method that checks for a file/size (filesize or curl) and then use Javascript to periodically call that method via AJAX? You could update the uploading UI with a status using the values in the responseText. I’m only speculating here, but I don’t know why Perl is necessary. Of course, I should probably look at the source of tesUpload. 😉

  2. That’s actually exactly what it does. The perl does the actual uploading to get around any restrictions php has on process time and file size.

Leave a Reply

Your email address will not be published. Required fields are marked *