A few potential issues:

) what OS are you on?
) is the owner of the directory the same as the owner of the script?
) is the relative path correct in relation to the location of the script file?
) what would $ test -d dir-name return?

Oh, and, why have you got quotes around the (variable) argument to id_dir()? have you tried without?

    *) what OS are you on?
    The server is unix based

    *) is the owner of the directory the same as the owner of the script?
    yes

    *) is the relative path correct in relation to the location of the script file?
    destination: ../sections/images/store/main_pic/
    script location: ../store/admin/

    ** I'm thinking it may have something to do with this. "../" basically refers to the root directory, doesn't it?

    *) what would $ test -d dir-name return?
    Sorry, I'm not familiar with that.

    ** I tried removing the quotes, but it still did the same thing.

    Thanks for you help,
    ~Oni.

      OniLink wrote:

      I'm thinking it may have something to do with this. "../" basically refers to the root directory, doesn't it?

      "../" refers to the parent of the current working directory. $_SERVER['DOCUMENT_ROOT'] refers to your root directory.

        try the full path from the "/" root directory of the server. Something similar to this:

        $upload_dir = '/usr/local/apache/htdocs/sections/images/store/main_pic/';

          [man]is_dir/man should work just fine with relative paths, so... are you positive that's the correct path?

          If your script was hosted at /home/username/public_html/store/admin/ and you used a path of ../sections/images/store/main_pic/, then you are effectively looking for directory /home/username/public_html/store/sections/images/store/main_pic/. Is this what you expected?

            These are the absolute paths:

            script location: root/store/admin/
            destination: root/sections/images/store/main_pic/

            so they are on different branches.

              Look at your directory structure, and look at my example. You're not going back enough directories.

                Well it's not just a random guess on how many dots to add...

                In a directory path on most file systems, "../" means simply go up one directory. In your case, the last directory that the two paths had in common between the script's location and the upload directory is the "root" directory. Do you see what I mean by the last directory "in common"? The "root" directory was the last directory they shared before they split off into different directions.

                So, what you need to do first in the script is to get back to that common directory, and then work from there. Since you're two directories past that directory ( "root/store/admin/" ), you need to go back two directories. So, our path so far is:

                ../../

                Now, we're back to the "root/" directory. From here, just add on the path to the upload directory, leaving you with:

                ../../sections/images/store/main_pic/

                  Thanks mate. I'll test it out.

                  ** it works. Thanks.

                    These are the absolute paths:

                    script location: root/store/admin/
                    destination: root/sections/images/store/main_pic/

                    so they are on different branches.

                    The paths above aren't absolute paths because you're missing a "/" on the beginning. These are correct:

                    /root/store/admin/
                    /root/sections/images/store/main_pic/

                      Oops, forgot to mention that. But since he went back enough to a common directory, we really don't need the absolute paths (if there are parent directories still).

                        Write a Reply...