This is a problem I get only on IIS and not on apache with version

Drupal 6.4
Content Construction Kit (CCK) 6.x-2.0-rc6
FileField 6.x-3.0-alpha4
ImageAPI 6.x-1.0-alpha2
ImageCache 6.x-1.0-alpha2
ImageField 6.x-3.0-alpha2

If I change the Imagefield module back to the older version version ImageField 6.x-3.0-alpha1 there is no problem anymore, and everything works fine.

The directories have the right permissions. it also happens with userid 1.

Eugene

Comments

dman’s picture

Is this just about the difference between naming your files x.jpeg and x.jpg?
.jpeg is rare, but should be legal and supported. if not, it's a bug that can probably be fixed easy.

Eugene Dubois’s picture

No, I should have said that. It doesn't really matter what type of file you try to upload...

I also installed MimeDetect 6.x-1.0-beta1, because I thought it had something to do with that.
And I installed php_fileinfo.dll from pecl4win.

shopgirl_11’s picture

Project:ImageField» Image Assist
Version:6.x-3.0-alpha2» 6.x-1.0-beta1
Component:Code» User interface

Hi,

I also have this same problem and can't seem to get through this. :(
I only added Image assist module... Actually, the weird thing is: i was able to upload images before and did'nt have any problems but as of yesterday, I can no longer upload any images in jpg, gif or png format.

Please help me resolve this error, not sure how to fix this anymore.

Thanks.

P.S.
This is my first time to post... I would really appreciate any help from you guys.

shopgirl_11’s picture

Hi,

I also have this same problem and can't seem to get through this. :(
I only added Image assist module... Actually, the weird thing is: i was able to upload images before and did'nt have any problems but as of yesterday, I can no longer upload any images in jpg, gif or png format.

Please help me resolve this error, not sure how to fix this anymore.

Thanks.

P.S.
This is my first time to post... I would really appreciate any help from you guys.

sun’s picture

Project:Image Assist» ImageField
Version:6.x-1.0-beta1» 6.x-3.0-alpha2
Component:User interface» Code

I guess that Eugene and shopgirl are having 2 completely different issues... Hence, moving back to original project.

zbricoleur’s picture

I fixed this by modifying the core image.inc file. I guess I'm too lazy to do it right.

In /includes/image.inc, change line 117 from:

  if (!is_file($file)) {

to:

  if (!is_file($file) && !is_uploaded_file($file)) {

shopgirl_11’s picture

It works! Thanks for giving an easy solution for me zbricoleur. :) You made my day!

Monkey1’s picture

When I do this I get a new error telling that the files cannot be copied from c:/window/temp/

I am using 6.4 trying to upload avatars and my hosting is on HELM..

Any more advise on how to fix this please?

zbricoleur’s picture

At admin/settings/file-system, try changing C:\WINDOWS\Temp to sites/default/files/temp

motto’s picture

Same Issue for me. Some JPG/JPEGs work though. I can't find any reason why some work and some don't.

I'll go back to alpha1 and stay there until there is a new fixed version out.

methetweb’s picture

The image.inc hack worked miracles for me, actually I had the image module instead of the ImageField. I can finaly upgrade my last 5.x sites to 6.4.

THANKS!!!

Have been fiddling and trying for the last few months. I moved straight to Drupal 6.4 from 5, had this problem with all image modules so far.

On the temp-file error: it's a folder access issue. The IIS useraccount needs read/write permissions on the temporary file folder. Easiest and savest way (in my oppinion) to do this is to have a temporary file folder within the website folder.

Eugene Dubois’s picture

Ok... we had the security upgrade to Drupal 6.5 now...

Because the fix involved changing a script in the core files, we had to adapt this again.
I don't think that this quick fix really is really a solution.

zbricoleur’s picture

It is not a permanent solution, since you have to bring the change forward with every Drupal upgrade. That is certainly true.

On the other hand, it IS the solution in the sense that it fixes the real problem, which is that image.inc relies on PHP's is_file function. That is not a problem with Apache, but on IIS that function does not work the same way. In particular, it returns false (or an error, I forget which) when the file in question has just been uploaded (e.g., via Image Attach) and is in the WINDOWS/temp directory.

I've submitted a bug report on this issue (http://drupal.org/node/307636) but it doesn't seem to have caught anyone's eye yet.

dtateii’s picture

I was having this exact same problem, but with the image module, image 6.x-1.0-alpha3. Using both of zbricoleur's solutions - changing the temp directory and replacing the line in the image.inc file finally solved the problem. Thanks!

SuperContraXTC’s picture

I kept getting the same error message when trying to upload an image. I went crazy over this, lost a few hairs and a few lbs for not eating, trying to solve the problem.

After I changed

Changing line 117 from:
if (!is_file($file)) {
to:
if (!is_file($file) && !is_uploaded_file($file)) {

it solved the problem. I can rest now...

Thanks for the solution.

jenlampton’s picture

Version:6.x-3.0-alpha2» 5.x-2.2

I'm having the same problem on a 5.14 drupal install, and I'm on an apache server. Any chance my issue is related or is it just a coincidence? (things worked fine with the previous version of ImageField - after the upgrade to 5.x-2.2 I can't upload any images anymore without the error.)

Thanks,
Jen

zbricoleur’s picture

Actually, I misspoke above. The issue isn't specific to the web server software, it's specific to the OS. I.e., it could/would occur on a WAMP (Windows Apache MySQL PHP) setup. If you are on WAMP, try changing that one line in image.inc as detailed above. It won't hurt anything, and it will probably help.

quicksketch’s picture

Version:5.x-2.2» 6.x-3.x-dev
Status:Active» Fixed

The Drupal 6 problem should be fixed by #397578: Uncouple ImageField from FileField Custom Hooks. Please reopen if you're experiencing it in the latest development version (which will become beta1 shortly).

Let's keep this issue focused on the original Drupal 6 problem. Please open a new issue for Drupal 5 if one does not already exist.

Status:Fixed» Closed (fixed)

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

scifisi’s picture

@zbricoleur

I used your solution:

In /includes/image.inc, change line 117 from:

if (!is_file($file)) {

to:

if (!is_file($file) && !is_uploaded_file($file)) {

Worked perfectly! It's a shame it's been nearly a year and this same problem is still in the core code. While I was at it I also changed:

On the admin/settings/file-system, try changing C:\WINDOWS\Temp to sites/default/files/temp (also made sure it was writable by the web server) and again all ticketyboo thanks very much!

methetweb’s picture

Issue tags:+Windows, +IIS, +uploading images

Just want to mention that this issue is still very alive. I recently upgraded to drupal 6.12 from 6.4 and then to 6.13. for each upgrade I had to edit the image.inc and alter:
if (!is_file($file)) {
to
if (!is_file($file) && !is_uploaded_file($file)) {

I've recently learned that drupal 7 will have a whole set of image handling modules in core and it's worrying me that this problem has not been solved in drupal 6 yet. I believe http://drupal.org/node/307636 is about the same problem.

I am running
- windows 2003 enterprise
- IIS 6.0
- drupal 6.13
- php 5.2.3
- mysql 5.0.45