My Digital Garden

How to upload large media to your WordPress site

How to upload large media to your WordPress site

Note This approach is very specific to a particular set of tools, but could be generalised to most setups


  • a website running Wordpress
  • a large media file (or zip file containing media files) that is too large to directly upload
  • (ideally) a tool such as WP Offload Media already installed and configured to offload media to an S3 bucket

You also need:

  • a web-accessible location for the file (in my example, Microsoft OneDrive )
  • shell access to your web server
  • the WP CLI installed


  1. place your media file(s) in your web accessible service (in my example, Microsoft OneDrive for Business)

  2. Generate a sharing link that is accessible to anyone with the link, copy and paste it into a text editor. In the case of OneDrive for Business, add &download=1 to the end of the link.

    In the rest of this note, this full URL is referred to as DOWNLOAD_URL

  3. SSH into your web server as the correct user for your Wordpress site

  4. create a temporary directory, for example mkdir ~/mediatmp

  5. cd ~/mediatmp


    note the importance of putting the URL in double-quotes - this is so any special characters are not misinterpreted by your shell

    wait for the download to complete

  7. change directory to the root of your WordPress site, for example cd ~/public_html

  8. wp media import ~/mediatmp/DESIREDFILENAME

  9. log into the backend of the site and go to to the media library, check the item is there and edit any settings

  10. delete the temporary file(s) in ~/mediatmp

See also