Closed (duplicate)
Project:
Drupal core
Version:
4.7.0-beta2
Component:
upload.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2005 at 23:20 UTC
Updated:
27 Jan 2006 at 20:54 UTC
When I'm uploading a .jpg and .png files underneath a test page as an attachment.
They upload fine under firefox but for some reason they are changed into text files and have .txt appended to them.
I was getting this error earlier For /tmp/phpFkRMej the system thinks its MIME type is text/plain while the user has given image/x-png for MIME type
These are most definently just normal .png files.
I just tried saving the drupal logo.png from this site and it got changed into a .txt file by the upload/js
Just to mess around I uploaded a random .exe file from the desktop of this XP box and it also had .txt appended to it.
Comments
Comment #1
metapunk commentedSorry I didn't mention the server info on the previous post. I'm running Ubuntu Hoary with
Apache/2.0.54 (Ubuntu) mod_jk2/2.0.4 PHP/5.0.5-2ubuntu1.1 and MYsql 4.1.12
Comment #2
heine commentedGo to Administer > Settings > Uploads and check if png is listed as an allowed extension.
Comment #3
metapunk commentedjpg and png and all of the defaults are listed under allowed file types
you can verify this by going to a new test site I set-up at http://drupaltest.azone.org
even anonymous users can upload files and see that they all get interpreted as txt.
I'm going to set-up a blank 4.7beta2 on a different server to make sure it's not server specific.
Comment #4
metapunk commentedSo I tested this on a server running Php 4.4 and Apache 1.3 and I didn't get the error. So it is some variable of the set-up which is causing this. Anyone have any suggestions as to where to look ?
Comment #5
Cvbge commentedI had this problem too, I don't remember if I did anything with it...
Comment #6
JymBrittain commentedI too had this problem when using drupal 4.6.3 on XAMPP for Windows. It turns out mime.magic module for apache was not configured correctly, nor did the magic config file have descriptions for the files I was having problems with [in my case mp3s, excel and powerpoint files]. IMHO depending on mime.magic might be a mistake, as there are many file types for which this information does not exist [case in point .wma files]. I describe my journey to enlightenment on this problem here - http://drupal.org/node/43180
Comment #7
chx commentedIf your MIME magic is broken then use disable_functions in php.ini to disable mime_content_type function.
Comment #8
Eglish commentedAlthough not really the best way, couldn't you just input the MIME types into httpd.conf?
Comment #9
metapunk commentedI didn't have mod.magic enabled as a module, but even after I've enabled it it still doesn't seem to work. I've restarted Apache2 and I can't get it to work, it seems like the module is installed, does anyone have any pointers on how to further troubleshoot this, I shouldn't have to edit my magic.mime file should I ? I'm using Ubuntu which is debian based so it should have most image files in their by default right ?
Thanks for any help.
Comment #10
metapunk commentedThis error isn't caused by drupal but rather by a misconfiguration of mime.magic or the mod_mime module within Apache2.
Comment #11
metapunk commentedThis is the same error that is discussed here http://drupal.org/node/43220 and here http://drupal.org/node/43568