I've installed Fedora RedHat Linux, PHP5, MySQL & Drupal 4.6.5. Everything works okay.
I then installed the image module following the instructions and this also installed okay. However, when I try and upload images I get an error message:
warning: mime_content_type(/tmp/php00ZI31)
[function.mime-content-type]: failed to open stream:
No such file or directory in /var/www/html/drupal-4.6.5/includes/file.inc
All the directories have permissions set to 777. I went through the installation instructions a number of times and tried anything I could find that may have been causing the problem with no success.
I have also installed Drupal 4.6.5 a couple of times on a hosted Linux server and added the image module. Both these work fine. I have also installed Drupal in Windows 2000 with the image module and this also worked fine. I finally started editing the Drupal code to add breakpoints and error messages so I could step through the code. I located where it is erroring but am still not sure why.
This is what I found:-
When an image is uploaded (e.g. picture01.jpg) it gets copied correctly to the Linux /tmp directory with a unique name and with the same extension. e.g php00ZI31.jpg.
This is where things go funny. For some reason the temporary file then gets renamed to php00ZI31.txt before it can get copied to the Drupal /files/temp directory. This is what then causes the Drupal error message:
warning: mime_content_type(/tmp/php00ZI31)
[function.mime-content-type]: failed to open stream:
No such file or directory in /var/www/html/drupal-4.6.5/includes/file.inc
Having checked the code the file.inc php file is checking the mime type of the temporary file (now php00ZI31.txt) and finding a text/plain mimetype. This is not the same mimetype as the image/jpeg mimetype of the downloaded file (which was php00ZI31.jpg), so it errors as it is looking for a file called php00ZI31.jpg to copy to /files/temp; but can only find php00ZI31.txt.
I found a couple of other threads which seemed to touch on this subject but not directly. These are: