How do I upload hundreds of images in a post?

I want to upload more than 1000-3000 images to a post using the ‘Add media’ functionality.

If I add them to the media upload window (drag and drop or select), the browser warns me that the script is lagging. Eg on firefox:

Read More

A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.Script: ../wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2&ver=4.1:2

I’m guessing this is expected, as the ajax call to upload the images hasn’t returned, hence it seems like its busy.

How can I tweak this to wait, while this particular functionality is called?

Note: This is part of a plugin I am making where the user would be required to attach hundreds of images in each post (like a gallery). Of course I want to use the existing functionality and not reinvent the wheel.

Related posts

Leave a Reply

2 comments

  1. This is expected behaviour, as most ajax upload scripts send the files as you drag and drop. Depending on the size of the photos you could be consuming the maximum amount of RAM for the browsers (since most are 32 bit)…. 3000 images at 1 MB each is 3GB and near the limit. It would likely take a few hours to churn through that much data.

    A suggestion would be to setup an sftp account and then having a script import those files. The transfer would take less time. The bulk import wouldn’t be all that long a minute or two.

    The reason why I suggest this, is that web browsers were not design to do bulk upload of files. Is it possible? Yes. Do I recommend it? No. Much like how I wouldn’t recommend taking my ferrari through a 3 foot deep puddle. Your method of stuffing the files through php for bulk uploads taxes your server as well. I wouldn’t recommend trying to parallelize it either. You will add a significant load to your server and might cause the site to stop responding.

    Doing the upload outside of your web server (apache or ngix) is a much safer, secure, less resource draining solution.

  2. You want add 1000 or more images in post means directly upload the

    YOURSITENAME/wp-content/uploads/currentmonthfolder

    and if u completed means you should add the img tag manually in particular post