I tried uploading any image file or zip file and i get the below error:

The selected file trinity2k2.jpg cannot not be uploaded. Only files with the following extensions are allowed: image/png, image/gif, image/jpeg, application/zip, application/x-zip, application/x-zip-compressed, application/x-compress, application/x-compressed.

The selected file Cruise.zip cannot not be uploaded. Only files with the following extensions are allowed: image/png, image/gif, image/jpeg, application/zip, application/x-zip, application/x-zip-compressed, application/x-compress, application/x-compressed.

I have .zip compiled into php:
Zip enabled
Extension Version $Id: php_zip.c 305848 2010-11-30 11:04:06Z pajoye $
Zip version 1.8.11
Libzip version 0.9.0

any ideas on how to fix this?

Comments

DrunkMunki’s picture

Still no luck.

using PHP 5.2.17 (i know its old but some custom modules were design for this version only)
i tried using the -dev version but the issue still persists.

anyone else get this issue straight out the box?

mauro72’s picture

I have the same problem, in my case it seems to be something related with transliteration module, when transliteration checkboxes are unchecked(in /admin/settings/file-system) the images work. I'm testing in D6.
Any ideas?

DrunkMunki’s picture

i would just like to confirm i have transliteration installed too, investigating to see what i can do to fix it.
My version of transliteration is 6.x-3.0-rc1

DrunkMunki’s picture

ok i applied the patch for transliteration at http://drupal.org/node/1243974
-no go

removed transliteration completely and from the db
-no go

still not having any luck.

ok i just removed and uninstalled all modules to the site except this module and some core modules... stil didnt work.. has to do with the module itself.

barteque’s picture

Any solutions?
I'm having the same problem
no matter what version of imagefile_zip I use

DrunkMunki’s picture

i've had no luck in solving this, was thinking it may have something to do with the server MIME types but the files specified are listed.

and no help form the author....

mikeytown2’s picture

What version of CCK are you using? I developed this module for CCK 3.x and it sorta works with 2.x but it's not fully tested. The function that is throwing that error is in imagefield_zip_file_save_upload() on line #1120. One of the validators is throwing that error; if you can track down the bad one that would make solving this go a lot quicker :)

DrunkMunki’s picture

i upgraded to 3.0-dev and still same results.
log file isnt showing any errors besides the one already indicated.

mikeytown2’s picture

That error message doesn't exist in this module. I need you to tell me what functions are being called on line 1101 foreach ($validators as $function => $args) {

DrunkMunki’s picture

line 1101++

  $errors = array();
  foreach ($validators as $function => $args) {
    array_unshift($args, $file);
    // Make sure $file is passed around by reference.
    $args[0] = &$file;
    $errors = array_merge($errors, call_user_func_array($function, $args));
  }
daluxz’s picture

I'm having the same problem.
The errors I get are similar to the errors in post #1.

I tried to dpm $validators on line 1101, but the script doesn't seem to get there when you select an image to be uploaded.
It looks to me like DrunkMunki had the same error as I did (only it was worded a bit different, that's why post #9 suggests this error is coming from someplace else). The error I had came from imagefield_zip_save_and_extract_upload, line 341.
The error seems to come from filefield.js line 18.

To me it seems like the validation is doing something wrong. The error says that only certain FILE EXTENSIONS are allowed, but the list of allowed items shows MIME-types...
It looks like the validation tries to validate the file extensions against the MIME-types, which won't work.

When you look at the form, $form[NAME OF YOUR IMAGEFIELD_zip][NAME OF YOUR IMAGEFIELD_upload]['#attributes']['accept'] contains mime-types (image/png, image/gif, image/jpeg, application/zip, application/x-zip, application/x-zip-compressed, application/x-compress, application/x-compressed). If you change this to 'jpg, jpeg, gif, png, zip', the form validates and you can happily upload files.

daluxz’s picture

After some further investigation it looks like the Filefield module uses the 'accept'-attribute for filefield form-elements to validate the files that are going to be uploaded.

This validation function (filefield.js line 18) expects file-extensions, while in imagefield_zip_build_upload_form() the 'accept'-attribute is filled with mime-types. I'm not sure if this is done on purpose, but I think this should be changed so the 'accept'-attribute contains only file-extensions.

mikeytown2’s picture

What version of filefield are you using? I'm using 6.x-3.10

daluxz’s picture

I'm using 6.x-3.7

I will try to update to 6.x-3.10 and see how that works out.

daluxz’s picture

Updating Filefield to 6.x-3.10 fixed the issue for me.
It looks like filefield now uses a Drupal.setting to validate against, instead of the accept-attribute.

Maybe you can add a note to the project page telling what version of Filefield to use?

mikeytown2’s picture

Category: bug » support
Status: Active » Fixed

3.7 is almost 2 years old! I've updated the project page saying this requires that version or newer. Changing this status to support request and fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.