public String uploadMethod(@RequestParam("file") MultipartFile file, HttpServletRequest request) { if (!file.isEmpty()) { try { BASE64Encoder encoder = new BASE64Encoder(); // 通过base64来转化图片 String data = encoder.encode(file.getBytes()); } catch (Exception e) { e.printStackTrace(); } } return null; }
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;