Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
file.inc from version 1.52 uses mime_content_type()
in file_check_upload()
to determinate the uploaded files' mime type. As result drupal can not recognize flash (.swf) files in Fedora Core 3, 4, CentOS 4.2 and maybe others as there is no entry in /usr/share/file/magic.mime for flash. This breaks at least banner.module in 4.6.5 (as would in 4.7.0-beta3 too) resulting in wrong mime type and file extension.
For me getimagesize()
in the attached patch fixes the problem.
* maybe node/16142 is related to this one.
Comment | File | Size | Author |
---|---|---|---|
#2 | 44165-testsuite.tar.gz | 10.01 KB | mr700 |
file.inc-fix_flash_mime.patch | 1.13 KB | mr700 | |
Comments
Comment #1
mr700 CreditAttribution: mr700 commentedI also have similar problem with drupal-4.6.5 - can not upload user picture (avatar). The message in the watchdog says:
and the page says:
The 'avatars' directory exists and after applying the attached here patch it works fine. The file was in png format (gif and jpeg work fine). I used Fedora Core 4 (mysql 4.1 and php 5).
PP: Should I fill new but report for 4.6.5 and cvs?
Comment #2
mr700 CreditAttribution: mr700 commentedHere's a small test suite with php script and 3 images that can be used to verify this problem. My results are:
Just me?
Comment #3
Egon Bianchet CreditAttribution: Egon Bianchet commentedOn Ubuntu breezy:
Comment #4
mr700 CreditAttribution: mr700 commentedHmm, strange. I did some more tests on all linux boxes I have. Here are the results:
In short: everywhere flash gets wrong MIME type ('text/plain'), for "Fedora Core 4" png also gets 'text/plain'. The problem with png files is clearly a FC4's bug (I reported this in bugzilla - bug # 177926).
The main problem I have are flash files (with banner.module). Can you please also test a flash file?
BTW:
mime_content_type()
returns 'text/plain' where it does not recognize the file,getimagesize()
returns nothing.Comment #5
chx CreditAttribution: chx commentedhttp://drupal.org/node/43220 will solve this & many more.