How to Change the Timeout on the Modern File Upload


Would you like to change the timeout when uploading files through the Modern File Upload form field? By default, the timeout on the file upload (Modern) is set to 30 seconds, with a small PHP snippet you can set this timeout to be whatever you’d like.


Simply copy and paste this PHP snippet to your site. In our example, we’re changing the timeout from 30000 milliseconds (30 seconds) to 60000 milliseconds (60 seconds).

 * Change the timeout on the modern file upload from 30 to 60 seconds.
 * @link

function wpf_dev_modern_file_upload_timeout() {
	<script type="text/javascript">
		window.addEventListener( 'load', function() {
			if ( typeof wpforms.dropzones === 'undefined' )  {
			wpforms.dropzones.forEach(function( dropzone ) {
				dropzone.options.timeout = 60000; // The timeout for the XHR requests in milliseconds.
		} );
add_action( 'wpforms_wp_footer', 'wpf_dev_modern_file_upload_timeout' );

And that’s it! You’ve successfully increased the timeout from 30 seconds (30000 milliseconds) to 60 seconds (60000 milliseconds). Would you like to also track successful form submission with Google Analytics without the need of a plugin? Check out this snippet on How to Track Successful Form Submissions Without a Plugin.

Action Reference: wpforms_wp_footer