This is an extremely trivial thing but one that had me stumped forever (well, until I decided to check the error logs and see the error). I had a large file (mysql backup of a huge forum) that was only partially being uploaded to a remote backup server. Couldn't figure out why, until I realized that the max execution time was being hit since it was taking longer than 30 seconds to upload this file.
<?php
set_time_limit(0);
rest of the code here....
?>
That did the trick. It's one of those dumb, trivial things, and if you're having trouble like I, it may be something you overlooked.