示例#1
0
文件: Upload.php 项目: semnt/tp01
 public static function uploadFile($file, &$result, $options = [])
 {
     $rootTmp = static::getTmpUploadsRoot();
     // FileHelper::dirTtlClear( $rootTmp, 3600, [ 'deep' => true ]);
     $rndKey = StringHelper::rndHex(8);
     $ex = strtolower($file->getExtension());
     $key = "{$rndKey}.{$ex}";
     $path = "{$rootTmp}/{$key}";
     $file->saveAs($path);
     $result[$key] = [];
     if (array_key_exists('cbSave', $options)) {
         $options['cbSave']($file, $key, $path, $result);
     }
 }
示例#2
0
文件: Image.php 项目: semnt/tp01
 public static function getRndKey()
 {
     return StringHelper::rndHex(8);
 }