mkdir() says theres no such directory and fails?

后端 未结 7 2044
逝去的感伤
逝去的感伤 2020-12-16 09:07

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:

7条回答
  •  借酒劲吻你
    2020-12-16 09:45

    It happens because you don't have images/listing-images/rent path existing in your filesystem.

    If you want to create the whole path - just pass the 3rd argument as a true:

    mkdir('images/listing-images/rent/'.$insertID, 0777, true);
    

    There is also a chance you're in a wrong directory currently. If this is the case - you need to change the current dir with chdir() or specify the full path.

提交回复
热议问题