hi

i go crazy, webfm doesn't want to allow me to upload files...permissions are good :

FCKEditor permissions : "allow file upload" et "use fcke"
WebFM permissions : “transfert webfm” ; “Accéss à WebFM”,”Administer"

i've this error on dashboard : File Information Extension Activated

So i don't understand why it doesn't work...

ideas ?
thanks

CommentFileSizeAuthor
#17 webfm.module.patch458 byteshawthorne
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aiphes’s picture

in addition : upload are allowed for www.ndd.com/webfm but not via fckeditor...but i've this error :
lycee-metiers.jpg has an invalid extension

aiphes’s picture

Category: support » bug

new info after update to 2.18:

    user warning: Table '23008_d6rostand.d6er_webfm_file' doesn't exist query: SELECT * FROM d6er_webfm_file WHERE fpath = 'sites/all/media/webfm/accessoires/logo-pf-sites-lycees.jpg' in /home/.../www/rostand/sited6/sites/all/modules/webfm/webfm.module on line 3170.
    <em>signature-pf-hd.jpg</em> has an invalid extension

if someone know

nhck’s picture

Category: bug » support

this

user warning: Table '23008_d6rostand.d6er_webfm_file' doesn't exist query: SELECT * FROM d6er_webfm_file WHERE fpath = 'sites/all/media/webfm/accessoires/logo-pf-sites-lycees.jpg' in

says you do not have a webfm_file table. Did you check your database if it exists?

As for the allowed upload:

Can you upload that file through the webfm interface at example.com/webfm?

aiphes’s picture

Can you upload that file through the webfm interface at example.com/webfm?

yes as #1

why webfm_file table didn't exist ? update could create this table not ?
with 2.16 patched for mime type all works but issue with 2.18...

nhck’s picture

Dear aiphes,

^.

why webfm_file table didn't exist ? update could create this table not ?

This is an error with your website and your database. The update did not change nore create any tables. As I told you you need to check if this table exists in your database. If it does not you need to reinstall webfm.

2.
Also there is no such error "File Information Extension Activated" - there is only one if you do not activate the file information extension. I don't know what patch you are talking about or if that patch was successfull for you. We make the File Information Extension a requirement for webfm because it is the only safe way to tell if an uploaded file actually is what it pretends to be.

3.

signature-pf-hd.jpg has an invalid extension

This error just means that you are either not allowed to upload that type of file or that you are trying to upload a jpg file which really isn't one.
If you expierience this - why not try to upload a different file? Or check the upload-settings for this file?

aiphes’s picture

ok i will do a downgrade to 2.16 patched version which works...because file extension issue come from webfm here : http://drupal.org/node/1109382 , so is it fixed in 2.18 ?

nhck’s picture

Status: Active » Closed (cannot reproduce)

Issue #1109382: V2.15 Image Exploit Checking Problems (invalid function call/ invalid extension errors) that you are referring to was already fixed in 2.16 - so there is no need for patching that version. From 2.16 to 2.18 only minor issues were incorporated.

aiphes’s picture

Status: Closed (cannot reproduce) » Active

i've reinstall webfm in 2.18 for one of my websites and all works except the mime type file ..i've these settings

Extensions autorisées : jpg jpeg gif png txt html htm doc xls pdf ppt pps dwg zip gz
Taille maximale de chaque fichier : 4 Mo
Taille totale des fichiers par utilisateur : 200

and i've this message: plan-cg-02.jpg has an invalid extension , strange no ?

mducharme’s picture

This is still not fixed in 2.18. Either the patch was not rolled into it or there is a separate, related issue. I am going to test the latest dev version since it was mentioned here http://drupal.org/node/1109382#comment-5060870 that is was in the latest dev. If the error persists I'll post my environment details.

nhck’s picture

Well you will need to because the issue was fixed in 2.15 already. Sorry to trouble you guys with this. I just really need more information. If the fileinfo-extension is not present we fall back to mime_content_type() and if thats not present we fall back to a drupal function file_get_mimetype().

That being said you can try one thing for me to debug:

In line 3119 in webfm.module try to change it from
$err_msg[] = t('%filename has an invalid extension', array('%filename' => $file->filename));
to

 $err_msg[] = t('%filename has an invalid extension. It is really mimetype: %mimetype', array('%filename' => $file->filename, '%mimetype' => $mimetype));

Can you post the result here? I've read some comments that due to a strange configuration of apache it could be that mime_content_type() always returns 'text'...

Thank you.

mducharme’s picture

I updated the code as per your suggestion and the $mimetype output is just an empty string.

myfile.jpg has an invalid extension. It is really:

I have fileinfo extension enabled. phpinfo shows it is enabled and the drupal status report shows:
File Information Extension Enabled

Manually running extension_loaded('fileinfo'); returns 1.

Uploading file types like file.txt works just fine.

Server Version: Apache/2.2.16 (Debian) PHP/5.2.6-1+lenny16
Drupal 6.24
Web File Manager 2.18

Let me know if I can provide any other details.

Thanks

nhck’s picture

mducharme, okay for you the fileinfo-extension is working ~ for aiphes it is not so that is a different case.

However mducharme, we should check why it is not getting a mimetype. You could enable devel and insert after line 3069

dpm(finfo_open(FILEINFO_MIME_TYPE),'finfo_open'); //maybe this returns an error?
dpm(finfo_file($finfohandle, $file->filepath),'finfo_file'); //or this returns nothing?
dpm($file->filepath,'filepath'); //could be due to a strange filepath?

dpm will post a drupal message containing our details

nhck’s picture

aiphes’s picture

in my case i just do a test and i've this message : essai-1.jpg has an invalid extension

so i can upload but system doesn't want my file for mime type issue...but not on all my websites..
globally they all use fckeditor and webfm...so i don't understand why it works in some cases only..

nhck’s picture

in my case i just do a test and i've this message : essai-1.jpg has an invalid extension

Sorry but you did not understand what I was telling you. It should also say something like " It is really mimetype:" Also you need to provide debug information by devel. Maybe your servers are badly configured.

kidorion’s picture

For what it's worth...

On our apache server mime_content_type() is returning null. I'm not an expert so I don't know why. Regardless, the webfm code should check for this rather than create an error.
So this is what I did to fix it...
At line 3057 replace..

  elseif (function_exists('mime_content_type')) {
      $mimetype = mime_content_type($file->filepath);
  }

with

   elseif (function_exists('mime_content_type') && $mimetype = mime_content_type($file->filepath)) {
   }

Hope this helps.

hawthorne’s picture

Category: support » bug
Priority: Normal » Major
Status: Active » Needs review
FileSize
458 bytes

FILEINFO_MIME_TYPE is available as of php 5.3, so on older versions of php this will not work. Using FILEINFO_MIME instead works fine.

Here's the diff, patch attached.

webfm.module line 3053:

--- webfm.module        2012-04-02 09:25:26.000000000 -0700
+++ webfm.module.fix    2012-04-02 09:25:59.000000000 -0700
@@ -3050,7 +3050,7 @@
   if (extension_loaded('fileinfo')) {
     //use Fileinfo extension
     static $finfohandle = FALSE;
-    if ($finfohandle || $finfohandle = @finfo_open(FILEINFO_MIME_TYPE)) {
+    if ($finfohandle || $finfohandle = @finfo_open(FILEINFO_MIME)) {
       $mimetype = finfo_file($finfohandle, $file->filepath);
     }
   }
nhck’s picture

Well hawthorne, but isn't finfo_open available before 5.3.0 either?

aiphes’s picture

ok it explain why it doesn't work on my websites running under php 5.2.10...

hawthorne’s picture

nhck, the pecl package fileinfo was superseded when it was added to php 5.3. For older versions of php, install the pecl package http://pecl.php.net/package/Fileinfo usually with something like pecl install fileinfo or in the case of a redhat flavoured system yum install php-pecl-Fileinfo should do the trick. I just had to do this on an older CentOS system running php 5.1.6.

nhck’s picture

nhck’s picture

Did anyone take the time to test this?

nhck’s picture

Status: Needs review » Fixed

Didn't receive an complaints.

Status: Fixed » Closed (fixed)

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