輝念了崔�� 旗鷹痴 >> 忝栽 >> ファイルのアップロ�`ド、ダウンロ�`ド、CSVファイルの�iみ�zみ
  �袁現眈�圭宛

ファイルのアップロ�`ド、ダウンロ�`ド、CSVファイルの�iみ�zみ

犯業��54   窟下扮寂��2024-01-18 16:00:01.0

ファイルのアップロ�`ド��

public void uploadFile(FormFile file, String savePath)
     throws FileNotFoundException,IOException{
  
  BufferedInputStream  bis=null;
  BufferedOutputStream bos=null;
  
  try{
   bis = new BufferedInputStream(file.getInputStream());
   bos = new BufferedOutputStream(new FileOutputStream(savePath));
   
   int b =0;
   while((b = bis.read()) != -1){
    bos.write(b);
   }
   
  }catch(Exception e){
   
  }finally{
   if(bis !=null) bis.close();
   if(bos !=null) bos.close();
  }
  
 }

ファイルのダウンロ�`ド��

public void downloadFile(HttpServletRequest req,
        HttpServletResponse res,
        String filepath) throws IOException{

  File file = new File(filepath);
  
  res.reset();
  res.setContentType("a

  �犢惱眈�圭宛