在服务器的根文件夹之外创建文件夹.PHP


Create folders outside my root folder in server. PHP

所以我在一个名为"UserActions"的文件夹中有一个php文件名NewUser.php。

"UserActions"位于名为"General Elements"的文件夹中NewUser.php在数据库中插入用户数据,现在是我的问题,我需要上传的用户图像保存在文件夹user Images中,该文件夹位于其php的根文件之外。

我正在使用mkdir(),但我不知道如何访问文件夹UserImages。

0. General Elements
  0.0 UserActions     
     0.0.0 NewUser.php  //MkDir() function
  0.1 UserImages        //I need to create a folder here and save here the images.
      0.1.0 User_0
         0.1.0.0 MainImage.jpg
         0.1.0.1 MainBackground.jpg
      0.1 User_1
         0.1.1.0 MainImage.jpg
         0.1.1.1 MainBackground.jpg

我假设php所在的文件夹不是实际的服务器根目录,只是一个文件夹。您可以简单地在路径中使用..来提升一个级别。例如:如果我试图从NewUser.php访问Userimages文件夹,我会使用../Userimages/