Webhosting Blog

K2 – Gallery upload error: Cannot extract archive in Joomla

Using K2, you can transform your Joomla! website to a news/magazine site with author blogs, product catalogs, work portfolio, knowledge base, download/document manager, directory listing, event listing and more, all this bundled under one package! More information related to K@ can be found out at URL:: http://getk2.org/

While uploading zipped images in K2 I was dealing with following error:

Gallery upload error: Cannot extract archive!

Even after the server was having the  support for the zip files the server was issuing the error.

Following is the fix for this.

1) Login to the server as root

2) Locate the file /home/user/public_html/administrator/components/com_k2/models/item.php.

3) Open the file .

[root@server~] # vi /home/user/public_html/administrator/components/com_k2/models/item.php

4) Locate the line

$handle->allowed = array(“application/rar”, “application/x-rar-compressed”, “application/arj”, “application/gnutar”, “application/x-bzip”, “application/x-bzip2”, “application/x-compressed”, “application/x-gzip”, “application/x-zip-compressed”, “application/zip”, “multipart/x-zip”, “multipart/x-gzip”, “application/x-unknown”);

5) At the end just add the following to the end of this line:

$handle->allowed = array(“application/rar”, “application/x-rar-compressed”, “application/arj”, “application/gnutar”, “application/x-bzip”, “application/x-bzip2”, “application/x-compressed”, “application/x-gzip”, “application/x-zip-compressed”,  “multipart/x-zip”, “multipart/x-gzip”, “application/x-unknown”, “application/zip“);

This helps to recognize the MIME type of .zip as required.

Once done try to re-upload the zipped images. This should resolve the K2 error now.


7 responses

  1. Hi, i think that i saw you visited my blog so i came to “return the favour”.I am looking for ways to add things to my website!I suppose its ok to use some of your ideas!!

    December 9, 2010 at 8:36 am

    • I can not fix the same error in my site? Help me

      January 19, 2013 at 4:28 pm

  2. Pingback: zip command to exclude the directory « Php Bugs

  3. Gustavo


    Quero acrescentar que esse problema, parece ser relacionado a arquivos zipados com WINRAR, e, ficando arquivo “.rar” ao criar arquivo zipado no winrar selecione, formato ZIP conseguirá enviar.

    May 8, 2011 at 5:58 pm

  4. Dears,
    It’s working normally on my PC (local server), but have the above mentioned error. I have my hosting server safe mode on, and tried to make a local php.ini but with no luck. your help is deeply appreciated.

    October 11, 2011 at 1:58 pm

    • Hi,

      Please consult your hosting provider as they can check for the logs and help you accordingly in this concern.

      October 12, 2011 at 5:29 am

  5. I can not fix this error in my site!
    Who can help me online with yahoo:
    My yahoo is: vietiplaw

    January 19, 2013 at 4:27 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s