Hi all, Just getting into Drupal and loving it - used nucleus in the past, Drupal is sooooo much better!

I hate for my first post here to be begging for help, but this is doing my head in, and I've read countless similar posts that haven't helped. :-(

I'm simply trying to Enable picture support under user settings, but Drupal is telling me that the picture directory doesn't exist. It does, it has the correct permissions (I'm developing locally btw), I have a tmp folder also with correct permissions and I've tried entering the path into the field both with and without slashes at either end ( / or \ ). All to no avail. I've also tried clicking disable or restore defaults but I still get the same error.

Is anyone able to help me out with this?

Thanks in advance,
Jonathan

Comments

mohan.ka’s picture

what version of drupal are you using? i am using drupal5, and it works for me fine. i just enabled the picture support and it works fine without any error. the "picture" folder is automatically created inside "files" folder and i am able to upload user pictures.

alexrayu’s picture

An obvious contradiction, huh? The statement that Drupal Shows in fact does not mean that the directory does not exist. It means only that it does not exist where it is expected to be found - in the Drupal root folder with the path of "files/images". ALSO, please see if you module has in it's settings the path to the folder pointing elsewhere. From my experience, in cases like this, it ALWAYS turned out that either the folder was misplaced, or the path setting was incorrect by pointing elsewhere.

jonathangoodwin’s picture

I'm using Drupal 5.

I don't think the paths are wrong, as in the file system settings I have set the file system path as '../files' which Drupal sees. Then on the user settings page it is asking me which folder specifically within ../files I wish to use for the images. It's as if it sees the root files folder but not the pictures folder within it - which is definitely there with correct permissions.

Could the problem be arising because I'm using a folder outside the Drupal installation folder in order to mantain privacy as per the instructions on the file system page? I shouldn't think this is a problem as Drupal doesn't seem to have any trouble seeing the 'files' folder, just the folders within it.

Steve Hanson’s picture

Perhaps your web server can't read the directory because the permissions on the files folder prevvent it. It's hard to tell since you don't really say in any detail what you've done with the permissions. I'd also drop the leading . -- that's probably just confusing the issue since it's going to be rooted in the main Drupal directory anyway.

Steve Hanson
Principal Consultant Cruiskeen Consulting LLC
http://www.cruiskeenconsulting.com

Steve Hanson
Principal Consultant Cruiskeen Consulting LLC
http://www.cruiskeenconsulting.com
http://www.cms-farm.com

NancyDru’s picture

Definitely 5.1. I did, however change my file setting from "files" to "files/KB". I guarantee you that the directory exists and even has some pictures already in the "pics" directory that I tried to get it to use. Furthermore, it created a new directory "files/kb" (lowercase), but still won't let me use that.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

alexrayu’s picture

That sounds reasonable that Drupal does not recognize a folder outside it's root directory, it sure does. Isn't drupal your root directory? Anyway, I suggest that you do it the way it is supposed to be =)

NancyDru’s picture

"files" is in the Drupal root directory, right where Drupal created it at installation. It worked fine until I added the /KB directory part - that is, files/pics was happy time, but files/KB/pics is a no-go.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

jonathangoodwin’s picture

I'm running my webserver locally on Mac OS X 10.4 - I have set the files folders and all folders within it to read & write for all users. This is defiantly right, as when originally setting the file path I forgot to do this and Drupal detected it and reminded me. So if this was the issue on the sub folder for pictures I think Drupal would detect it.

My Drupal installation is in a sub-folder of my Apache htdocs folder (I have multiple web projects that need to be kept separate), but I have put my files folder above this (hence ../) beacuse in the file settings it states that this folder shouldn't be accessible on the web if you wish it's contents to be private.

However, I am willing to try putting everything back to default, but could someone tell me how it's supposed to be set up, as my reset to default button doesn't work as mentioned before! Specifically where should the files & pictures folders be located in relation to the Drupal installation?

Thanks for all your help everyone by the way! :-)

NancyDru’s picture

I don't think there is a default for that field. However it is stored in the variable named 'user_picture_path'. I just went into the database and fixed it by hand. Now everything is working the way it should.

BTW, I'm not sure why you're saying "../" You definitely should not be doing that. This field is a directory within the setting in the files setting in site configuration.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

jonathangoodwin’s picture

I will have a look at my database!...although I'm not 100% what I'm doing so will be careful not to wreck it!

Btw, I'm not saying "../" for my pictures folder, just for my files folder which is one step up from the Drupal root. The pictures folder is/should be inside there. I.e. The complete path to the pictures folder on my system should be "../files/pictures/" or just "pictures" from within the User settings field.

z_heise’s picture

Thanks for your cookbook, Nancy - it's been very informative! However, I would like to ask you where that SQL structure is - I'm in myPHPadmin right now, but it's not making itself readily apparent.

I'm having the exact same problems that the others are having, and mine isn't going away as simply as changing the path to something else, and then changing it back...I have experience messing around in databases so I don't mind altering a few. Plus, it helps that my site hasn't been rolled out yet, so it's not big deal if something happens to it yet!

Thank you in advance!

NancyDru’s picture

There is a table in the database called "variable." It stores the values of the system variables in unserialized form, so you have to be careful with changing it, especially if the length changes.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

z_heise’s picture

I just looked there where you said, and there doesn't seem to be a user_picture_path entry in here! I see a "files/tmp" and "files" entry for the file_directory_temp and file_directory_path variables, but the one you speak of simply doesn't exist.

Should I add it back in manually? That makes me nervous. I don't know how or where it would go, and if it's as delicate as you said even in terms of length...

NancyDru’s picture

You're lucky on this one because it is so simple. The value in my table is s:4:"pics";. In this case, the "4" is the length of the string, so if your directory name is shorter or longer, you need to change that. Make sure that directory exists in your file path before adding this variable.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

z_heise’s picture

I assume you mean "pics" so in your case it would be from the root, files/pics? So I set mine to s:8:"userpics"; and then saved it...then cleared IE's browser files and then reopened it...and it was still stuck to ../forums/avatars/pics (where I had put it on a whim before but didn't like it)...how on earth could this thing be so tenacious?? :P

runarut’s picture

Using the method outlined above, I modified the directory value in the database.

It still didn't appear to allow end-users to set their profile picture. The error message indicated that an older value of the directory was being used.

Then I thought about caching. Duh!

I truncated each of the cache tables within the database and poof - it starting working correctly for me.

What a colossal pain in the ....

At least it worked. Thanks to all of those who posted to this thread so that I might be successful.

styro’s picture

is fine despite some of replies in this thread. I've used that exact setting a lot. Although if your site is a subdirectory of htdocs, then wouldn't ../files still be under htdocs and visible to the web?

It's still not clear that your permissions are correct. What are the permissions you've set and (more importantly) what are the user/group ownership settings? Also what user/group does your web server run as?

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

jonathangoodwin’s picture

Apologies for the long post here, need to convey a lot of info!

Although if your site is a subdirectory of htdocs, then wouldn't ../files still be under htdocs and visible to the web?

This is a good point.... but it can be explained!.... on my local computer where I am building my site I have one webserver installed, with one htdocs folder containing sub-folders for each site. When I actually come to putting this site online the drupal files will be in the htdocs folder and the files folder above that - in affect moving everything up a level!... I know this is probably bad practise and there is probably a better way of doing things, but I am new to all this! So whilst technically you are right Styro, it shouldn't really affect this immediate situation I'm trying to resolve.

I'm not sure I understand which permissions you need me to verify are correct. At the moment the only permissions I am aware of changing are for the actual folders. i.e the 'files' and the 'pictures' folders. I have set (using the OS X get info panel) these folders to be read/write for all users - Is this not in effect mirroring the required '777' permissions that would be set via FTP if I was using a live webserver?

With regards to the running of my webserver it is running on an admin profile so should be fine. Although as stated before I'm sure this isn't the problem as Drupal doesn't seem to have any problems with my files folder, just it's sub-folders.

With regards to what was posted above about editing the database directly - I don't have a table named user_pictures_path - should I have? As there seems to be other similarly named tables there for other things.

jonathangoodwin’s picture

Wohoooo!!! After hours of tinkering and trying to get my head round this I've finally sorted it!

All I did was go the File System settings and change the 'file system path' to a path that I knew doesn't exist. It then of course tells you "this directory doesn't exist". At which point I changed it back to my original path, saved and navigated back to the user settings page. Which, to my surprise, had reset with a blank field for the 'picture image path'. I entered 'pictures'.... and whaahay I'm up and running!

Strange but true! As you've probably all gathered by now, I'm not too clued up on Drupal's inner workings (yet), but I can only assume there was some kind of glitch in the database which got cleared?!

Thanks to all those who helped me out today!
Jonathan

erika’s picture

hi,I'm alos trapped in the direectory does not exist thing.
its for the images directory...and when I try to add new content type the same directory does not exists....
any suggestions.I'm a newbie...pl help me

NancyDru’s picture

Make sure the directory IS there. The Images directory is not created by default. Also make sure your base file directory (admin >> site configuration >> file system) is set the way you expect it to be.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

erika’s picture

Thanks for your immediate response.I was using the same image directory and I've images even now.I'm getting this problem as I hit reset to defaults by mistake.After setting my original path also it throws me the same "directory not exists"
I'm unable to create new content type even.I was able to create it previously.When ever I click add content type tab I get "directory does not exist"
Administer >content management > content types > Add content type tab

The base directory exists
Any suggestions.Thanks for your help

NancyDru’s picture

erika’s picture

thanks Nanacy,
How do I check whether my directory permissions got changed?

NancyDru’s picture

I go into my cPanel and then to File Manager. When you say to change the permissions, it shows what they are first.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

cellmaker’s picture

Nancy -

You have lots of pull. Perhaps you could convey to the module kings and queens that they might want to steer people to problems like this when the system throws an error such as "There is no directory x." Your pointing me to the file system structure was a lifesaver. Too bad it couldn't have been pointed out by the system itself!

Thanks,

c

NancyDru’s picture

I have no pull. Some of the Drupal-gods are even openly hostile towards me. However, if you send me an email through my contact form, I may see if I can work out a patch to submit. Who knows, they might even accept it for D6.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

sundhar@groups.drupal.org’s picture

I too have same issue , when i goto the file system path i see files in that textbox. I just confused that in the Temporary directory i have a local path .

So, please tell what we need to change in that both textfields.

Thanks

erika’s picture

what I did was created a new folders in the same name and it worked.
If you've fixed the bug,post it.let others not suffer like us.

maxiorel’s picture

The same problem for me was because of wrong path in temp directory settings, after I moved from windows localhost to linux web. So I have changed the "c:\windows\temp" to the "tmp" and everything is working now :-)

Jan Polzer, Drupal & Symfony developer

jdvc’s picture

Hey Jonathan, Your solution worked like a snap, very simple, it must be glitch in drupal somewhere, this happened to me on drupal 6.9. I'm not sure all the other posters on the issue really understand the problem. All I gotta say is try Jonathan's solution people, it may seems simple, but it works! I have no idea why, someone enlighten me.

jdvc’s picture

!

ctmann’s picture

I initally entered a file in User Settings/Picture Image Path field, and now nothing I do will stop this awful "The directory files/images/profiles/anonymous1.gif does not exist."

I cleared the field and disabled picture support. The message appeared. I re-enabled picture support. Message appeared. Tried entering a bogus folder. Same error. Changed themes and tried again. Error.

This really is awful.

RoiDanton’s picture

Hi all,

I had the same problem with the user picture directory.
I'm 110% sure that the file system path is set correctly and the file permissions are set correctly.

The annoying thing is, that I can't submit any changes to this site until I enter the damn path. Even if I try to disable the user picture. I just want to change the way to register!!

Also strange is, when I add an avatar as an administrator to a user, the picture is stored in the right path.
Only the settings page is failing to verify the path. And also a normal user gets this error message when he tries to add a user picture.

Any ideas?

Regards,

Roi Danton

RoiDanton’s picture

I've got something.
I found out, that the error is misleading. It was not the temp folder in the image folder which had 775 rights but it needs to have 777. So now the path is accepted.
But this is not the end. The users can now upload images and I can find them in the folder that has been created. The problem is now, that the image can't be read by anyone. I see in the log files an access denied and in the user profile is only a red x.
Why can't someone view the pictures?!

Thanks for your help!

universeinside’s picture

Hi Jonathan and All:

I had this same inexplicable issue some time ago: File folder created with the right permissions, everything seemed fine but was not recognized by Drupal.

In my case it was an issue with the PHP Safe_mode. The server was using Linux Plesk 8 control panel and it was set to have PHP Safe-mode ON, and that was preventing Drupal from reading the folder. Turning it OFF (the default value) solved the issue immediately. Don't know why it was ON, but it took me a while to get to that troubleshooting idea.

Anyway I hope it helps.

So: "Watch out with the PHP Safe_mode ON or OFF in Plesk8 (should be OFF), it prevents from Files to be read!"

BR,

Nicolás Amado

Universe Inside Consulting

RoiDanton’s picture

Hmm I had the php save mode off for some reason.
So this is not a solution for me :(

STNyborg’s picture

Sad but great to read that I am not the only one experiencing "The directory does not exist.".

I experienced that users could not display their images frontend - only when they were editing their profiles. Therefore I tried to alter the "Picture image path". Now I cannot make it accept any kind of path; says that whatever directory I try it does not exist.

Any help is appreciated,
Svend

Paradise-Bodies’s picture

Ok, after 2 days i gave up on this. Know i see im not the only one.
Ok, the other thing i see in some threads is that this problem exist since 2006.
And the strange thing behind that is that this top priority bug is not fixed since over 1 year.

My problem is that i can do nothing now in Drupal untill i get this runing.
Funny thing. Changed it in the DB and still if i try to upload drupal is complaining about the old path.

Just to be sure:

File path: files
Temp: /tmp
Userpictures: pictures

main-folder (www.mydomain.com)
___l
___l___drupal-folder
__________l
__________l___files-folder 777
________________l
________________l___tmp-folder 777
________________l
________________l___pictures-folder 777

I also attempted to set owner and group permisson to Apache (maybe www-run problem) but still no luck.

STOP

After my last phrase i took a hurried glance on my tree above. Why the hell "/tmp" (was what drupal made after installation)?
Ok, test "tmp". Booooom it worked.

Ok after waisted hours. It was not the userpicture-path, it was the tmp-path. But in global seting Drupal was not complaining about "tmp" does not exist.....
DAMN - need a cigarette....

________________
To The Extreme

my.wahyu’s picture

If Doesnt Not Exist... so it must be exist or put existing list
i dont like change permission
i think default is realy safe.. (let others module to keep this folder safe)

After Read This
The directory to import image nodes from. Drupal will need to have write access to this directory so we can move the file.
Note: a path begining with a / indicates the path is relative to the server's root, one starting without specifies a path relative to Drupal's root. I.e. /tmp/image would be the temp directory off the root while tmp/image would be inside Drupal's directory.

I try to put my existing directory to this command panel:
sites/default/files/temp/image

PREVIEW
http://lh3.ggpht.com/_XE7k1yGWGhU/TFOUrjipWFI/AAAAAAAAAL8/tfHat4bKHJs/s8...

And then..

* Your settings are configured correctly, you can import images here.
* The configuration options have been saved.

Error message Directory Does Not Exist is Gone.
Newbie drupaler
__________________________________________________________________________

holland1945’s picture

Also wasted about two hours on this. I did exactly as he said: went to file system, listed a different file folder, Drupal couldn't find it so it created it, then went back to admin/images, saw a permissions error on the previously unfindable images folder, and now things are ok.

editing the database did not work for me.

askibinski’s picture

I'm having the same cannot-create-temp-dir-problem with drupal 5.5 - image 1.7 as everyone else.

After spending a couple of hours fiddling with all the remarks in this en many other posts I tried to do a fresh drupal install (5.7) and only image 1.7. Bam! Worked as a charm. So I guessed it would have something to do with drupal 5.5.

On the site with the problem I decided to upgrade to 5.7. I followed the steps in the upgrade guide to the letter and succesfully upgraded to 5.7. (fresh install, not overwriting anything) Then I installed the image module. But you guessed it... exactly the same problem. files/images is created without any problem but temp - no way...

So I guess the problem is somewhere in the database as that is the only thing from the old site with the problem.

I also tried manually adding the image fields in the variable table used by the image module. With no result.
The only thing left for me is to do a fresh install (not upgrade) en copy the existing content...

I'm really frustrated with this problem and since I lost a whole day on it allready I'm not going to deep further in the codes. I just hope this information helps somebody...

Albert Skibinski - Homepage

gavin_s’s picture

I'm subscribing to this thread as I have exactly the same problem.

abqaria’s picture

u should create the directory by ftp program in the files directory

see the directory in the users ettings that gives u the error and create it

shanizar’s picture

I have a problem that might be related to this...
Directories and files created by Drupal get owner/group set to 99/99. This is different from my ftp user which means that I can't edit directories created by Drupal.
In addition, I'm unable to upload files to, or create subdirectories of, any directory created by Drupal. This means I can't upload images or anything from Drupal. I have to log on with FTP, delete the folder and create it again (then with new owner/group) to get it working (have to add write to public access for Drupal to get access).

This removes any security that Drupal is trying to provide for me.

Any ideas what is wrong?

I recently tried installing WebFM to use it for file handling, but I encounter the same problem there. I really need to figure this out...

styro’s picture

Lots of info here:

http://drupal.org/node/34022

Specifically:
http://drupal.org/node/34024
http://drupal.org/node/34029
http://drupal.org/node/34028

My advice: don't worry about administrating your uploads through FTP, leave it to Drupal. And if you really need to make an exception, use a PHP script to run the commands. That way the command runs as the same account that created the files.

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

shanizar’s picture

Thank you for the links, read them all. But I might not have made myself very clear... It's not just a problem with interaction between Drupal file handling and ftp file handling.
For instance, when I set up the Drupal file system in the first place...
Drupal created the files directory, no problem.
But it was not able to create the files/tmp directory. I logged on to FTP to check file permissions and the files directory was set to 755 with owner/group set to 99/99.
So even if Drupal had created the files directory, it was not able to create any sub-directories under it. I had to delete the files folder, create it with my ftp user and set permissions to 777. Then Drupal was able to create the files/tmp directory. I then had to delete this directory and create it again with 777 to let Drupal add files to the files/tmp directory.

So everytime Drupal creates a new directory and then wants to add a sub-directory or file to it, I have to log on via FTP to recreate the directory with permissions set to 777.

This doesn't seem right to me, and I assume the reason why it happens is that the user/group of 99/99 is a special case. I'd love a system where I can do all file handling from Drupal and where you have to go through Drupal to get access to files as I assume this would make allowing certain roles access to certain files/folders easier. I've heard talk of script-wrappers that make the web-service run as a different user (my own user), but not sure how I would implement something like that. Or if it would have to be implemented by the host. (using shared host)

EDIT: Seeing that the web-service (Drupal) needs access to files to function properly, does that mean that anyone who guesses/knows the path to a file on the web server can access it as well? Won't such a web request also use the web-service's user and as such would have read access as long as Drupal has read access?

messenger’s picture

deleted

smitcher’s picture

Hi,

I run into exactly the same problem and could not fix it using any of the suggestions here...

I decided enough was enough and delved straight into the code to find the offending line...

I discovered that this section was causing it (lines 2326-2330 of user.module,v 1.745.2.26 2008/01/07 02:30:35)

  // If picture support is enabled, check whether the picture directory exists:
  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    file_check_directory($picture_path, 1, 'user_picture_path');
  }

I commented out the line file_check_directory($picture_path, 1, 'user_picture_path');, re-uploaded the file and when I went to the 'User settings' page the error didn't show... great... but what have I broken I asked myself? Well nothing it appears...

I changed the settings I had to, changed the file path to one which existed (and I had tried before - without changeing any read/write settings), hit submit and it worked...

Hmmm... then I uncommented out the line and uploaded (what was in effect the original file) and tried editing the 'User settings' again...

This time NO ERROR ???

It seems that if someone could roll a patch for this file which simply catches any errors generated by file_check_directory($picture_path, 1, 'user_picture_path'); then this module should then work as intended... or maybe just add a try block..

  // If picture support is enabled, check whether the picture directory exists:
  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    try {
         file_check_directory($picture_path, 1, 'user_picture_path');
    }
    catch {;}
  }

I know this could be considered bad practice but having a much used module like 'user' out in the Public Domain with problems like this, and on-going for 2 years is pretty uncool...

John Smith
Glasgow Caledonian University

NancyDru’s picture

fletch11’s picture

I just wanted to let everyone know I tried everything on this and other posts and the only thing that worked was what john mentioned above (commenting out (//) line 2329 of user.module.

Thanks a lot John and I really hope this gets addressed.

Ian

martinking’s picture

Temporarily commenting out that line worked for me also.
Investigating a bit more, it appears that there was an invalid user_picture_path stored in the database (specifically '/files/pictures').

Since '/files/pictures' is not a real directory (the '/' at the beginning puts it outside of Drupal's document root),
file_create_path will return FALSE, and then file_check_directory will fail.

I realized something strange was happening when the error message I was getting was "The directory does not exist." (note the two spaces between directory and does).

So, if I'm reading this correctly (it's been a while since I looked at the drupal forms api, so I could be wrong), the form is checking the validity of the current user_picture_path variable (and failing) before saving the newly submitted value. That leads to this 'directory does not exist hell', where the value cannot be changed because the old value is invalid.

Extra confusing for me was the fact that changing/deleting the user_picture_path value in the variable table in the database didn't have any effect... I realized afterwards that I forgot about the variable cache!

I suspect that deleting both the variable cache and the user_picture_path value in the variable table would fix the issue.

Instead of the try/catch code above (I don't think file_check_directory is throwing exceptions, anyway), I think maybe when drupal detects that a value stored in the variable table is invalid, that variable should be cleared/reset (after displaying an error message).

But, take the above with a grain of salt. I'm fairly rusty on the drupal form validation/submission process.

NancyDru’s picture

mikeybusiness’s picture

I spent about four hours working on making this work. The following solution worked for me.

I discovered that this section was causing it (lines 2326-2330 of user.module,v 1.745.2.26 2008/01/07 02:30:35)

 // If picture support is enabled, check whether the picture directory exists:
  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    file_check_directory($picture_path, 1, 'user_picture_path');
  }

I commented out the line file_check_directory($picture_path, 1, 'user_picture_path');, re-uploaded the file and when I went to the 'User settings' page the error didn't show... great... but what have I broken I asked myself? Well nothing it appears...

I changed the settings I had to, changed the file path to one which existed (and I had tried before - without changeing any read/write settings), hit submit and it worked...

Smitcher's mojo worked for me. Thanks smitcher!

jstmilan’s picture

Spent the last hour searching for an answer. Commenting out file_check_directory($picture_path, 1, 'user_picture_path');, flushing all caches, and reloading the User Settings page worked.

file ver:: user.admin.inc,v 1.18.2.1

mickevich’s picture

Hello all, I'm new to Drupal, so I freely admit a lot of ignorance.

But I'm having the same problem with pictures in 6.2 that it looks like people have been having since 4.7. I've tried just about everything I've seen on all the boards, and no luck. I really want to try the "comment-out" idea, but it looks like the user.module for 6.2 doesn't have those lines.

Crying in my beer,
John

****UPDATE**** I found the line to comment out. It was in modules/user/user.admin.inc - followed the steps above, and it worked. Huzzah.

Red Sam Flint’s picture

DEITY BLESS YOU.

This problem has been causing me heartache for way too long and nothing worked until you pointed this out. Many thanks.

Unfortunately, I am now getting another error (with Drupal 6.2) when a user attempts to upload an image that conforms to the size, dimensions and file type restrictions. The error is "The selected file xxxxxxxxxxx.png could not be uploaded. Only JPEG, PNG and GIF images are allowed." Of course, as far as the actual image file is concerned, this is totally bogus and the file doesn't appear in the target directory either, which itself has 777 access. And yes, my tmp directory seems to be properly set as "tmp".

It's funny, because I also have the Avatar_Selection mod installed and it allows an Administrator to upload image files to a gallery of selectable avatars just fine.

This bug is a real killer. I'm trying to build a community website and needless to say users expect custom avatars. It should be a no-brainer. And I've experienced this problem in Drupal for years.

ggevalt’s picture

...That said, I think this might help you...

In the allowed file types, put in PNG in caps...

Hope that helps

geoff gevalt
http://www.youngwritersproject.org

trevjs’s picture

Could this be an issue involving the host? I'm waiting to hear back from mine, but I think the actual problem for me is that Drupal can't write to the directory I've named, and so it can't save changes to the theme etc.

NancyDru’s picture

Check to see that the directory has permissions set to 777.

davidlark’s picture

Most shared hosting these days uses phpsuexec. If yours does, maximum permission is 755, and files are quite r/w-able at 644. If your host does not use suexec, you might consider it a security risk. Check out http://www.joomlatutorials.com/faq/view/joomla_security_tips/permissions... .

alexrayu’s picture

Drupal shows an error warning unless your "files" folder is set to anything less then 777.

- Alexei Rayu.

Drupal Related Services | SiteHound 1.2 (based on Drupal 5.9) - Free Download

davidlark’s picture

With files directory set to 755, I was just able to upload files & download them w/ either public or private methods.

So now try this: write a php script that lists the contents of the server's /home directory. If successful, modify it to list someone else's home directory. If successful, create a blank file in that directory. Of course, you should warn your hosting company that you're going to try this experiment, so they won't think you're a cracker & kick you off.

Perhaps there are other security measures in place, but if you are able to access other people's directories, you might question whether you should be on this server at all. Note that a host switching to suexec is difficult because it will break everybody's php scripts unless they change everybody's permissions for them.

cdesautels’s picture

Just my two cents. I was pulling my hair out over a problem like this. It was because I migrated a mostly finished site from my localhost to a VPS server. The Drupal file system temporary directory was set wrong.

The tmp directory is not something one usually thinks to check because it's set by the installer and the developer rarely has to mess with it. The tmp directory on my desktop's apache server is definitely different than the VPS.

I changed the setting to "/tmp" and all the problems cleared up.

alexrayu’s picture

Ok. How to reproduce it (5.x).
1. Create a directory in /files/avatars
2. Navigate to Admin -> User Settings.
3. Enable the user images, and write in some wrong address into the text field (as if you mistyped). Type in "pictures/avatars".
4. Save settings.
5. An error will occur, and a message will be displayed, saying "Directory does not exist. Settings have not been saved."
6. NOW, howerver you ma try to change the text field now, it won't help! You are stuck with the error message.

WORKAROUND:
1. Logout and login again.
2. Navigate to the Admin->User Settings again.
3. The old erroneous folder address is still in that text field. No use trying to change it! So don't.
4. Recreate that address inside your /files folder. In our case, recreate the /files/pictures/avatars via ftp manager and click "save settings" on the User Settings page. It should save now.
5. Now you should be able to do the folders in the right wa and paste the right path in the path text field.

- Alexei Rayu.

Drupal Related Services | SiteHound 2.0 (based on Drupal 6.4) - Free Download. Please test and comment.

LoisMartin’s picture

Once more, I find that I have to go out and read a lot of developer-type information just to understand what's being said to fix a problem. This is not a user-friendly application! I'm working on a localhost setting and so am not using FTP at this point. I have been using a command line and changing config files, but it makes me very uncomfortable. I've put "Images" folders in every location I can think of and changed my File System settings in Drupal... I've read now at least 100 posts on this topic and I still have no idea how to fix the issue, so I'm done with Drupal. My client will simply have to use another open source product.

Lois Martin

NancyDru’s picture

Lois, the software may not always be the most user-friendly, but the community is. If you want someone to personally help, just ask.

NancyDru (formerly Nancy W. until I got married to Drupal)

LoisMartin’s picture

OK, I'm giving Drupal another chance. My issue with "Directory does not exist" is not limited to images. When I go to create any kind of page, I get this message. My "Files" and "Image" folders do exist in the correct places, and they have the correct permissions.

A related but slightly different problem is that, somehow, the Image module saved a configuration for where the image files are stored that is missing a slash and I can't fix it because the Drupal tells me the directory doesn't exist.

I have no idea how to even see a value in my MySQL database, much less change it. To fix the Image module problem, though, am I going to have to learn this?

And what about the other problem of not being able to create content? I had already uploaded some content into the database, so when I try a new install, it doesn't really install fresh. Do I have to lose all the work I already did and start over from scratch?

Lois

Jeff Burnz’s picture

Reading your other posts its sounds like your problems are related to your server set up and not Drupal at all - personally I use Wampserver on Windows, never had a problem.

Why not post a seperate issue asking for help - many competent users here who are willing to help (yes, users, not developers, you do not need to be a developer to build a site with Drupal, my mother-in-law is testament to that...).

Need help with IE?
Learn basic XHTML and CSS first.
Get smart with web specs.

darksleuth’s picture

Hi,

I'm using drupal 6 and followed your directions (setting permissions to 777 for folder and subdirectories...in my case user/pictures/avatars) and it worked great.

Thank you!!!!

sunchaser’s picture

confirmed
@Alexei Rayu : That Workaround was the only thing that worked for me. (6.X)

RoiDanton’s picture

It looks like my problem has shifted.
I can now change the path. I did nothing, I just updated finally to 5.11 and tried again. It may be an other upgrade - I don't know.
I just remembered the problem and tired if its maybe fixed and it was :)
But now the picture is uploaded but can not be displayed. If I put the link to the picture which I took out of my profile in an browser I get an access denied page from drupal.
How can I configure drupal to let me display this picture?

5Star’s picture

DRUPAL 6.8 - SAME ISSUE {STUCK} The directory does not exist

I am running the latest drupal 6.8. I went in to change a directory and for the user path, and BAMB! I am stuck!

Users / Picture image path:

I can not get it to point to any other directory I create. This is extremely frustrating and I have been at it for hours.......

5Star Administrator
5Star United

vinoth.3v’s picture

Still I have on Drupal 6.9.

But it works on main website but didn't in sub website (multi-site setup)

Tried all the possibilities except the code hack.

வினோத்
Tamil2Friends.com
Nettri.org

Vinoth - வினோத்

kuson’s picture

I had a problem " The directory does not exist" [when changed from sites/default to sites/mydomain and eventually solved it in Drupal 6.9.

It began when I was maturing in Drupal, and wanted to do multisite setup; So I had to migrate from using sites/default/files to sites/mydomain.com/files. When trying to configuration the site however, I received the error "The Directory Does Not Exist", which persisted on. I was not able to create more CCK Content Types and that buggered me and I googled around.

1. Site Configuration/Image / Files and Settings/:

Default image path: images [because the site already provided the path up to files portion] - initally I used the full path such as "sites/mydomain.com/files/images" and that gave the error].

2, SIte Configuration/ File Settings: Will require the full file path:
File system path: sites/mydomain.comt/files
Temporary directory: sites/mydomain.com/tmp
Initially I was using the short form, so that didn't work.

I admit I had done a few things to get to doing the above:
1. Uninstall Images, deleted "image_default_path" in the Variables Table in the Database, and reinstalled it and that's how I got the image to point correctly back to where it should point.

2. I did lots of permission changes but eventually found it wasn't an issue for my ccase: Changed to 777 for the mydomain.com at first, but after doing the below and changing to 775 it also works and now I'm at 755 later and still works. Again, it may be the case for the rest of you, and I suggest using FTP client to change file permissions "including subdirectories" option to mass change permissions.

Good luck to the rest of you!

"Lets Make Things Better"

Arodicus’s picture

SUMMARY OF ALL POSTS ABOVE

Folks, this is a serious bug in the User Module, and not just a permissions issue as the earliest posts suggest. The problem persists in 5.0 and 6.9 installations using the User Module; the exact problem is in the module itself, not Drupal per se.

The core problem here is a "Sanity Check" the module developer implemented to prevent the admin from entering a nonexistent path. It stipulates that if there are any problems with the User Page locating a directory (for any reason), Drupal will not allow you to save the changes on the page. From an initial setup point of view this is a good check; but problems occur if the status of the folder changes after you've set the path in Drupal, such as an accidental deletion or permissions tweak.

Once this "tweak" occurs, you cannot save ANY data on the User Module admin page, even if those changes happen to correct the problem. Even hitting "Reset" does not help, since it gets routed to the same broken sanity check routine.

At the writing, the only known fix is to comment out (//) the line as noted above in \modules\user\user.module (Drupal 5, look above for line number) or in \modules\user\user.admin.inc (Drupal 6, at line 418).

Once this is done, set the Image path field to blank, SAVE the page, then turn OFF user images (at least temporarily) then SAVE again. This will nullify the bug. At this point it's safe to turn user images back on again and reassign the field to a new value. (make sure the path is valid this time).

I leave it to your discretion to uncomment the buggy line. Nothing seriously bad is going to ahppen if you leave it out, so long as the pathname is valid.

decomposer’s picture

6.10 installed and this was a problem. Thank you all for chasing this down. I'm very new. What needs to happen to get this brought to the attention of the user.module or user.admin.inc maintainers? This one thing could run lots of people off from using Drupal.

To keep folks from having to refer to the posts way up the line from the one I'm replying to, what you look for in user.module or user.admin.inc is:

// If picture support is enabled, check whether the picture directory exists:
if (variable_get('user_pictures', 0)) {
$picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
file_check_directory($picture_path, 1, 'user_picture_path');
}

But, before you do anything, you might want to read over all these posts.

Personally, I commented out (using // like in the first line of the quoted code) this whole section, like:

// If picture support is enabled, check whether the picture directory exists:
// if (variable_get('user_pictures', 0)) {
// $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
// file_check_directory($picture_path, 1, 'user_picture_path');
// }

I uncommented them after following the instructions in the post I am replying to.

Good Luck!

Guty’s picture

Run into same issue with Drupal 6.15. Commenting out line 418 in user.admin.inc and acting as described in the two posts before did the job.

THANKS to you!!!

Guty

ssg13565’s picture

I am using Drupal 6.12 and I found that commenting out the suggested line of code did not work.

I discovered a call to _image_check_settings in /modules/image/image.admin.inc. If I commented this out and followed the rest of the instructions in the above post from the Drupal site, then the solution worked.

After I was finished, I put the code back to its original state.

mrgoltra’s picture

this did it for me. what a nightmare to upgrade from 5 to 6

Michael-IDA’s picture

Drupal 6.13 and two plus years and this is still a problem.

It's bad enough that I won't upgrade Drupal until at least a X.5 rev., but geezz this was a problem I've had to fix in 4.x, 5.x, and now 6.x..... Unfortunately the fix is always different, but I guess the good news is someone keeps trying to get it fixed....

For Drupal 6.13, here's the solution I used for problems with "directory files does not exist" , "directory tmp does not exist" , "directory pictures does not exist"...

First! IGNORE the "Subdirectory in the directory files/ where pictures will be stored." type help shown below the input boxes.

Second: Create the three directories "files" , "files/tmp" , and "files/pictures" and set the permissions to 777. (After you get it working try 755 for better security, but it's up to your hosting firm if they set suexec and/or web user account correctly)

Third: Use the full relative path in each input box: "files" , "files/tmp" , "files/pictures" in /admin/settings/file-system and /admin/user/settings .

Have shell access? Issue this from your root installation directory.

mkdir files
mkdir files/tmp
mkdir files/pictures
chmod 777 files
chmod 777 files/tmp
chmod 777 files/pictures

THANKS goes to everyone above, especially the code links as only after looking at the user module code is it obvious that the "help" is wrong, and it needs the full path...

Best Regards All,

Sam

Drupal Hosting

NIH Cancer Study: Supplemention with both vitamins and fenbendazole exhibited significant (P = 0.009) inhibition of tumor growth.

geerlingguy’s picture

I'd rather not have to do all these crazy things, and I haven't found the logic in 6.14 that controls this operation... a lot has changed since the solution in #32 (or wherever that was), and I am going to have to give up on right now, until I have more time to troubleshoot later :-(

__________________
Personal site: www.jeffgeerling.com

John Bryan’s picture

Even though everything was already 777 by two different methods of viewing and setting the file permissions it was only after deleting the files directory and the using commandline mkdir and chmod that it worked. Which will be no solution for those without command line access.

AliMartin’s picture

Hi

I also had the same problem but, following all the good advice in this thread, also realised another gotcha.

I migrated a development website from my Windows laptop to my web server, only to see the same picture folder issue suddenly happen. The SQL transfer was done using Navicat and it's a great tool for looking at the tables, etc.

Yes, I had the pictures and tmp/pictures folders created with 777 permissions and the correct "user_picture_path" setting in the "variable" table.

However, there is also the "file_directory_temp" field and my value was set to the old Windows installation path, i.e. s:11:"c:\wamp\tmp

When I changed this to s:4:"/tmp" (not forgetting to have created the "tmp" folder with 777 permissions) I was able to save the "pictures" setting.

Hope this helps :o)

Ali

uwashington’s picture

Ok everybody, after some Drupal soul searching I found out that you have to actually go to your ftp to find where your files/images files are under sites (on your ftp). Where ever it is write down the actual path of it. Then go to, admin, site config, images, image_import, scroll down to where it says "import path". Input whatever path you wrote down earlier, so it can point to where it actually is. For example, mines was under sites/default/files/image. Put that as the path under import path and wha la!!! Also, another thng I did was change the permission under every folder under sites to 777, just in case. It actually was able to place a temp folder there. So I don't know if the first part helped or the latter, or both but it worked!!!

OLimpikus’s picture

Look in your database the table variable, and edit this variable "file_directory_path", the value have sites/default/files/, change to sites/default/files, and it all, good look. Bani

cooldeeponline’s picture

I had the same problem and I did two things that solved the matter: (Solution for D6)

1. Usually while developing locally, our temp directory is set with reference to our local file path structure:
So once in remote server make the necessary changes at: (admin/settings/file-system/settings) and changed it to something like (Temporary directory: /tmp)

2. Check whether the Read/Write permission for the folder causing error is correct.. Can be 755 or 777 depending upon your requirement! You will need a FTP or if you are using cPanel then you can make the changes from your File Manager.