Upload Media by Zip

Upload a zip archive and let WP unzip it and attach everything to a page/post (or not).

Please note that you’ll still be restricted by your server’s maximum upload size.

If the zip file uploads, but the contents aren’t extracted, see the FAQs.

Languages

Download

Latest version: Download Upload Media by Zip v0.9.1

Installation

Standard installation

FAQ

Q. The zip file uploads, but the contents aren’t extracted
A. Try this: Open up the upload-media-by-zip.php file and locate WP_Filesystem() (line 301). Surrounding it are three lines labeled 1, 2, and three. Uncomment those.
This problem happens only on some server setups, I haven’t experienced it personally which makes it difficult for me to provide a better solution. If you have one, please share.

Q. The tabs in the media pop-up are all crazy
A. Sounds like you’re using 2.8. Update.

Changelog

0.9.1

  • Maintenance. Verified compat with 4.6

0.9 (20110808)

  • German localization added

0.9 (20110807)

  • Farsi localization added

0.9

  • Getting ready for translation, POT file may already be available
  • Bugfix: can now delete temporary upload despite hidden files

0.8.1

  • Bugfix: now shows correct message on failed extraction

0.8

  • Experimental “Insert all into post” feature (feedback appreciated)
  • List attachment IDs with ‘success’ message

0.7

  • fun with recursion – funky stuff should be fixed – sorry for the double update

0.6

  • zipped folders (any depth) now good-to-go
  • file extensions removed from title, like core uploader

0.5

  • allows contents of a zipped folder to be added successfully to the media library

0.4

  • linked Upload page to better capability (upload_files)
  • works with 2.8! (media upload tabs are wacky in 2.8, but I’m not going to fix it… because it’s 2.8)
  • minor wording changes (sticking with “upload zip archive”)

0.3

  • fixed compatibility with Quick Press

0.2

  • added zip uploader to media pop-up
  • first WP.org release

0.1

  • just getting started

18 thoughts on “Upload Media by Zip”

  1. Hi

    This is what i get when i use the plugin

    Fatal error: Undefined class name ‘self’ in /home/content/h/i/s/historicalone/html/wp-content/plugins/upload-media-by-zip/upload-media-by-zip.php on line 79

    1. I suspect that your server isn’t running PHP5. Could you confirm this?

      My fault for not indicating this as a requirement.

      Update: If you open up the php file, you should be able to replace all occurrences of “self::” with “upload_media_by_zip::” to get things working

  2. Been scratching my head for a while as to why it’s not working on my installation..

    Had a quick peak at the unzip_file function and its currently returning the following:

    WP_Error Object ( [errors] => Array ( [mkdir_failed] => Array ( [0] => Could not create directory. ) ) [error_data] => Array ( [mkdir_failed] => /var ) )

    I have chmod the temp folder but still to no avail.. any ideas where it is trying to create this folder? I’m hoping my problem is as simple as a permission setting!

    1. Are you trying to upload a zipped folder? It sounds like the unzip function is having trouble placing the extracted folder in the temp directory.

      1. Literally just a zip containing 1 image. Really odd issue.

        It seems it enters the following if statement, even though the unzip_file function returns an error:

        if( unzip_file( $file, $to ) )

        I will continue to have a play 🙂

        1. Odd… I don’t see any reason the plugin should be trying to create a folder then.

          Have you tried deleting and reinstalling the plugin?

          1. When I get a few minutes, I’ll investigate a bit more and see if I can find anything that could cause this. Thanks for reporting the issue though – for more useful than a “broken” vote without any additional info.

          2. Sorry to flood your post!

            After playing around, it appears it’s a problem with WP_Filesystem() on some shared web hosts, mine was always returning false.

            To force it to work I have wrapped that function call in the following:

            function _return_direct() {return 'direct';}
            add_filter('filesystem_method', '_return_direct');
            WP_Filesystem();
            remove_filter('filesystem_method', '_return_direct');

            Hope my investigation helps you take it forward 🙂

  3. Hi, I installed your plugin and there’s nothing wrong, but when i upload a bunch of pictures in a zip file, nothing happen, they don’t appear in the gallery or anywhere else, I reinstall the plugin a couple of times and still have this problem

  4. Hi,

    I have the same problem than many people: i upload a .zip, everything seems to work (if i uncheck the “delete zip” box, i can see the zipfile in media gallery) but zip content isn’t added to media gallery at all.

    I have a look at the code and found something that may be an coding error on line 255 of upload-media-by-zip.php

    if( unzip_file( $file, $to ) ) {

    By looking at wp-admin/includes/file.php, it seems that unzip_file returns:
    _ true if everything went ok
    _ WP_Error object on failure (so !false)

    So this test may always return true.
    You may modify it this way:

    $retobj = unzip_file( $file, $to ) )
    if ( ! is_wp_error($retobj) ) {

    However, i encounter problems with unzip_file() function like described above by Gareth, even then i wrap the WP_Filesystem call with his code, it still returns error like “unable to create directory”.
    I’m gonna get crazy … unable to upload my 700Mb of photos :/

  5. I am having trouble getting this plugin to work. I am using WordPress Multisite, which I think might be related to the issues. It looks like you are using constants for the file upload directories (http://codex.wordpress.org/Determining_Plugin_and_Content_Directories#Constants). Instead, I think it might work better to use the approach described here: http://codex.wordpress.org/Function_Reference/wp_upload_dir.

    Thanks for creating this; it looks like it should solve my needs perfectly if I can get it to work!

  6. Kailey Lampert Hello, how are you? I hope well …
    I loved your plugin but I wonder if a change is possible.
    When he needs to extract the files, leave the folders too, because in my zip there are some folders that it extracts the files and delete these folders. There is that possibility? How I do it?

Comments are closed.

Please use this plugin's WordPress.org support forum if you need assistance.