It's caused by a PHP time-out. If a PHP script takes longer than a specified amount of time to run (typically 30 seconds) the server will assume it's crashed and time out.
If you've got server access, you should be able to increase the time-out, but you're opening yourself up to problems if a page really does crash. Alternatively you need to upload in smaller batches.