By robertdouglass on
I'm running Drupal 4.7b2 and having a problem with a mismatch between the MIME type sent by the browser (for uploaded files) and the MIME type that the server thinks the file has. The warning, which comes from file.inc, looks like this:
<code>For /tmp/php5Jc9L0 the system thinks its MIME type is application/x-zip while the user has given application/x-zip-compressed for MIME type
For /tmp/phpIqDVKH the system thinks its MIME type is text/plain while the user has given application/pdf for MIME type
Running:
Debian Sarge
Apache/1.3.33
PHP 4.3.10-16
Drupal 4.7b2
Comments
same here
same problem, on Ubuntu. Breezy. Apache 2, php 5. Also have modrewrite on. File permissions should be good. Can't get avatars to work... still searching for clues...
"For /tmp/phpsCNagt the system thinks its MIME type is while the user has given image/jpeg for MIME type"
Mime type is ... blank?
~Savant
Same problem
Same problem, Drupal 4.6.x, Apache/2.0.54 (Debian), PHP/4.3.10-16
This happens with any file I try to upload.
i had the same problem
i had the same problem some time ago.
if your php is compiled with mime_magic, file.inc will use it. in my case, it used the wrong mime magic file (php setting mime_magic.magicfile). i changed it to use the magic file, which comes with apache and now everything is fine.
Which path has the file that
Which path has the file that worked for you?
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
path
i used /etc/apache2/magic, which is part of sarge's apache2-common package
I tried
I tried /etc/apache/mime.types from apache1 and that did not work. This is not surprise because the files have a different format. I still think this is rather a Drupal bug.
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
hm
perhaps it is, too.
from the php documentation:
i changed that,
(from /usr/share/misc/file/magic.mime) and now it works.
My current configuraton does
My current configuraton does work once I apply this patch:
http://drupal.org/node/43220
The mime type does get correctly identified.
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
Please help me to configure this
My server uses: /usr/share/misc/file/magic.mime
How can I override PHP settings, do I have to edit my php.ini file or is it enough to add new value in .htaccess, if so, please help me to figure out, what value to add.
It supposes to be something like this: php_value mime_magic.magicfile "somedir\magic.mime"?
You need to edit
You need to edit php.ini.
mime_magic.magicfile "somedir/magic.mime"
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
mime magic functions deprecated
I noticed here that mime magic functions have been deprecated:
http://us2.php.net/mime_magic
Only way I could get uploads to work was to comment out lines 150-156 and line 158 in the file.inc file.
anyone else have a solution?
This is due to a bug where
This is due to a bug where this part of the code is called again after the file was moved thus causing an error.
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
I worked around it by
I worked around it by installing the PECL fileinfo package, then replacing line 149 of file.inc with the following:
Seems to work ok so far.
= missing
If think it should be
mime_magic.magicfile = "somedir/magic.mime"
as commented somewere...
Add this section to your php.ini
[mime_magic]
mime_magic.magicfile = "/etc/magic"
works like a charm