Possible to prevent server from timing out when uploading bulk images?

We have a site on WordPress and use Woocommerce for our commerce site. In short we have a front end form that logged in users can upload multiple images at once. Problem is these images are typically straight off a digital camera and we need to keep them at the highest resolution possible.

When users try uploading even 50+ images it takes FOREVER and sometimes doesn’t even complete, it will return a 504 error.

Read More

We talked to the host and have done all we can with them to decrease server timeouts and they suggested making edits to the attached script. I also went in to the wp_config file and set the max upload size to something like 256M.

This problem is still happening and I was just wondering if anyone had any recommendations on how to prevent server timeouts or speed up image uploads without totally reworking the code?

The attached code is here: http://pastebin.com/AHTDNaDL

Just to save some time while browsing that file lines 3 -175 handle the product creation for each image uploaded; line 253 – 340 is the upload form and line 447 starts the binding functions.

I have been at this for days and googled everything from plugins to ajax uploaders but still not having much luck, thinking some outside input would help

Edit:
Since it doesn’t look like I will be able to configure my server to what I need, is it possible to break the upload/creating of product up into a few different sections? In other words, the user would be able to upload all there images and then in the background I could run my create_var_product function to hopefully prevent timeout issues?

Related posts

Leave a Reply

2 comments

  1. You need to edit your php.ini file. Look at editing at least the following:

    max_input_time
    upload_max_filesize
    

    Check the documentation:

    http://us3.php.net/ini.core
    
  2. Try adding the following lines to the top of the script:

    ini_set('max_execution_time', 10000);
    set_time_limit(0);
    ini_set('memory_limit', '-1');