版权声明:本文为博主原创文章,随意转载。 https://blog.csdn.net/king13127/article/details/78455959
public static void main(String[] args) throws IOException {
String docUploadPath = "D:\\home\\gg.docx";
File refereeFile = new File(docUploadPath);
byte[] refereeFileOriginalBytes = FileUtils.readFileToByteArray(refereeFile);
byte[] refereeFileBase64Bytes = Base64.encodeBase64(refereeFileOriginalBytes);
String UpFile = new String(refereeFileBase64Bytes, "UTF-8");
System.out.println(UpFile);
}