Solution 1 (the official method provided by ThinkPHP, I have not tested it): Upgrade to the latest UploadFile.class.php of ThinkPHP3.1 (https://github.com/ liu21st/extend/tree/master/Extend/Library/ORG/Net), download and replace the original UploadFile.class.php
Solution 2: Modify UploadFile.class.php Part of the code
This is my own solution, add a thumbnail subdirectory generation function
Step 1>>
Imitate the getSubName() function in UploadFile.class.php to create a getThumbSubName() function
private function getThumbSubName($file) {
switch($this->subType) {
case 'date':
$dir = date($this-> dateFormat,time());
break;
case 'hash':
default:
$name = md5($this->thumbPath);
$dir = '';
for($i=0;$i<$this->hashLevel;$i++) {
$dir .= $name{$i}.'/';
}
break ;
}
if(!is_dir(($this->thumbPath).$dir)) {
mkdir(($this->thumbPath).$dir);
}
return $dir;
}
Step 2>>
Change line 158 in UploadFile.class.php to
$thumbPath = $this->thumbPath?$this->thumbPath.($this->autoSub?$this- >getThumbSubName($file).'/':''):$file['savepath'];
Finally the problem is solved!