Using mkdir to create a directory, one more layer of directory I did not specify? (Resolved)

  question
This is thinkphp's upload settings, namely, file name, root directory and upload directory settings.
$upload->saveName  =       date('YmdHis').mt_rand(1000,9999).$customerid;
 $upload->rootPath  =     "./";
 $upload->savePath  =    'Upload/Home/headpic/'.customerid.'/';  //Set the attachment upload directory

As you can see, the directory I set up is spliced with the specified directory and user id.
The path actually generated has an additional layer of date.

clipboard.png


The problem has been solved.
As shown in the figure, Upload.class.php uploads class files under LibraryThink. Some screenshots are as follows.
There is a default setting that opens subdirectories and file names. Pit
clipboard.png
Set the controller to false
clipboard.png
Also, a friendly reminder! ! !
RootPath is very important! ! If you are using the default Uploads to upload folders and are in the root directory, you can ignore this operation. However, if your upload file storage directory is another file name under the root directory, then the rootPath needs to be set as above. According to your requirements, modify rootPath and savePath.

The file upload class of tp will create a new subName directory under the savepath directory and set $upload->saveName to null

Tp source code

Subname' = > array ('date',' y-m-d'),//subdirectory creation method, [0]- function name, [1]- parameter, multiple parameters use array

SubName defaults to date, setting $upload->subName = “”; Just do it