Installing the latest dev-version of image module gives me the "You must upload an image." error when creating an image node. Same happens using beta3 version of the module. I reseted image sizes and also tried to troubleshoot by creating 777 /temp directories in different directories (images, files, root) but nothing doesn´t make it work. log doesn´t show errors.
Drupal status shows that images directory is found and writable but could it be a problem that my Drupal installation is in a subdirectory on the server?

Comments

mygumbo’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta3

Same issue here, just upgraded to beta3 from an old alpha version.

No log errors.
777 sites/default/files/temp
My filesystem is public.

Drupal is at root directory on this server.

joachim’s picture

If you've checked all the obvious troubleshooting steps (see the documentation), then all I can suggest is that you do some debugging in image_form_validate(), starting from the end where that error message is set.

mygumbo’s picture

Since it happens with the garland theme and with multiple browsers, it would probably be a problem with a path or file permissions? What variables should I be looking at? I can see where the error is set but don't know where to begin.

joachim’s picture

Start here:

  elseif (empty($form_state['values']['images'][IMAGE_ORIGINAL])) {
    if (empty($_SESSION['image_upload'])) {
      form_set_error('image', t('You must upload an image.'));
    }

The error is being set, therefore both ifs evaluate to TRUE. So both things that shouldn't be empty are in fact empty.
The $_SESSION is set a few lines higher up, from $form_state['values']['images'].
So the real question is -- what is in $form_state['values']['images']? Why is it not the right thing?

Install devel module and do

dsm($form_state['values']['images'])

at various points working back from there to find out.

(BTW, this code all predates my involvement with this module, so I am as much in the dark as you! ;)

keeno’s picture

I'm getting "you must upload an image" error when the file size is too large instead of "The image you uploaded was too big..." error message. I'm using an older version though.

From my Image.info file

; $Id: image.info,v 1.5 2008/01/06 22:15:24 drewish Exp $
name = Image
description = Allows uploading, resizing and viewing of images.
package = Image
core = 6.x

; Information added by drupal.org packaging script on 2009-05-23
version = "6.x-1.x-dev"
core = "6.x"
project = "image"
datestamp = "1243037467"

mygumbo’s picture

Thanks for the help. It turns out that the permissions problem was with PHP settings. I had to edit vhost.conf to include:

<Directory "/var/www/vhosts/mt-example.com/httpdocs">
php_admin_value open_basedir "/var/www/vhosts/mt-example.com/httpdocs:/tmp"
</Directory> 

And then restart Apache so it would read the file.

Along the way, another piece of useful advice was to edit php.ini so that:

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = /home/username/tmp

This might've worked for us except we already had open_basedir turned on.

Anyway, the significant point is that if PHP is zapping the image upload, there won't be an error written to the drupal log, but there will be an error written to the server's PHP error log. Hope this helps someone else.

joachim’s picture

Category: bug » support
Status: Active » Closed (fixed)

I can probably mark this as closed then if it's all sorted :)