When uploading multi-chapters file, it stops (fails) in the middle

When you upload a multi-chapters file, it is probably big file. Thus, there are some reasons why the upload process stops and fails in the middle:

  1. The file is too big and exceeds your server upload limitIn this case, it will fail right after your file is uploaded to the server. Each server has its configuration to limit the maximum upload filesize. To change this, follow this guide: Increase max upload file size in WordPress
  2. The file is too big and it takes too long to proceedAfter uploading the file, the server needs to unzip the file, read folders and files inside and create chapters. If number of files are too many, it will take time and it may exceed the max execution timeout (max_execution_time) setting on your server. By default this value is 30 seconds, which is too small. You can increase this value to fix the issue. This value is also in php.ini file and you can do similar to the above guide.

    If you are using Nginx, there are several directives which control the timeout of HTTP requests. They are proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout. By default they are set to 300 seconds. You may want to increase them

  3. The file is too big and you are using CloudFlareIf you are using CloudFlare, bad news is that it has a 100s limit for all requests. So if your uploaded file is too big and your server needs to execute for more than 100s, the upload process will fail. In this case, there isn’t an alternative option but to divide the file into small ones so it fits into 100s time-frame
  4. Unknown reasonFor unknown reason, you can try to see what error messages are. To see the error message, turn on WP_DEBUG in wp-config.php (Debugging in WordPress) and see the logs in /wp-content/debug.logĀ or on some servers, in /logs/php_errors.log