Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
画像をc:/ imagesに正常にアップロードできました。ルートフォルダにをアップロードするにはどうすればよいですか?
String fileName = getFileName(filePart); FileOutputStream os = new FileOutputStream("C:/images" + fileName); os.write(b);
ServletContext.getRealPath(relativePath)ファイルの実際のパスを取得するために使用できます。
ServletContext.getRealPath(relativePath)
String relativePath="/images/" + fileName; String realPath=getServletContext().getRealPath(relativePath); FileOutputStream stream=new FileOutputStream(realPath);