Thursday, March 11, 2010

Drupal – The selected file… could not be uploaded. Only JPEG, PNG and GIF images are allowed

I’m using Drupal 6.13, I tried to change the logo for the admin template and got this error message. A little bit of digging turned up a comment made by zbricoleur  on the Drupal.org site where he provides a working solution.

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

  if (!is_file($file)) {

to:

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

That line above works nicely, however next up you might see the error:

The selected file  could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

To get around that problem do this:

Administer/File-System

You might find it under the 'Site configuration' heading and then File System.

There you will see a box that has: Temporary Directory

c:\windows\temp and change it to the same as the line above it which will probably be

sites/default/files

Save configuration and you're good to go.

:)

PS. Nobody leaves a comment if I help them, please let me know if this solution worked for you…

Related posts:

  1. Drupal Clear Top ‘page not found’ errors – How to?
  2. Site off-line The site is currently not available due to technical problems. Please try again later. Thank you for your understanding. (SOLVED!)
  3. Drupal mailhandler smtp localhost error
  4. Drupal Gmail Module – Solved.
  5. IIS and Drupal – Enable Clean URL’s


2 Comments

  1. Comments  tracedinchalk   |  Friday, 19 February 2010 at 5:01 pm

    I was getting the same error when uploading files.

    Changed the tmp directory to reside inside of the files folder and it resolved the error.

    Thanks for posting this.

    Cheers!

  2. Comments  Simon Nicol   |  Friday, 19 February 2010 at 5:06 pm

    A good tip there, thanks for adding your experience (it will be added to our own – resistence is futile) – lol
    :)

    Simon

Leave a Reply