Search code examples
phpuploadmkdir

mkdir() says theres no such directory and fails?


Im likely doing something very simply wrong, but when I try to make a directory (using a variable of an insert just performed as the last folder name), I get the error:

Warning: mkdir() [function.mkdir]: No such file or directory in /home/blah/blah

with the code:

if (!is_dir("images/listing-images/rent/'.$insertID.")) {
        //make new directory with unique id
   mkdir("images/listing-images/rent/'.$insertID."); 
}

of course the directory doesn't exist.. I'm trying to make it now? confused!


Solution

  • You have an error in your string:

    mkdir("images/listing-images/rent/'.$insertID.");
    

    should be:

    mkdir("images/listing-images/rent/$insertID");