Monday, September 12, 2011

Web Server for Uploads

On the heels of another perfect comic from XKCD, I thought it would be helpful to point out exactly what the difficulties of an upload app on a web server are. I've been playing with putting together a Webapp to do this for my company a la imgur minus the image bias.

These days to have two main choices for new servers: Windows/IIS or Linux/Apache/PHP/MySQL. Here are the pros and cons as I see them

Windows/IISLAMP
Prosweb.config files allow easy config tweaking on a per-folder basisPHP install is already done for you
ASPX scripts have generous POST upload file size limitsSSH access to server with minimal effort
ConsWindows has an enormous target on its backPHP default config has 2MB POST limit

End result: I love LAMP.

Here is what I've learned so far about configuration of LAMP for Upload Server duty:

  1. php.ini needs to have memory_limit, upload_max_filesize, post_max_size, max_input_time, and max_execution_time increased.
  2. The upload folder needs to have permissions tweaked to allow write access.
  3. SWFUpload is an excellent tool for taking super basic HTML form upload and giving it beauty and power. Because it is built on standard upload methods, it degrades gracefully for the flash opposed.

The missing part of the puzzle for me right now is managing the files that are uploaded. Everything I've read says that storing data directly in SQL tables is a bad idea. You have performance issues and scalability problems that don't exist if you just stick to file system storage. My solution is looking like some basic "I'm not a robot" challenges, a simple user form that creates a session record in a SQL table, then have the upload script add a file record that references the session record. I'm new to database structure, but I think it sounds robust enough to maintain a simple index of uploaded files and make them easy to retrieve, share, and delete.

No comments:

Post a Comment