package com.sf._05_uuid;

import java.util.UUID;

public class FileUploadUtils {

    public static String generateUniqueFileName(String orignFileName){
        // 1 获取文件后缀
        int index = orignFileName.lastIndexOf(".");
        String ext = orignFileName.substring(index);
        // 2 生成uuid
        String uuid = UUID.randomUUID().toString().replace("-", "");
        // 3 拼接新文件名
        return uuid + ext;
    }
}
