Check out [man]set_time_limit[/man]. It'll wiggle around the 30 second default time out.
As for the file types, application/octet-stream will kick start a download regardless of the file type. This might be a good idea if you're dealing with 2gb files. But in some cases like PNG, JPG, GIF, etc, you may toss in some code to just display it to the browser. And that's just a simple exercise in determining the file type and matching the content type with it.