Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Injection
- disabled
- PHP GCM
- javascript
- 시놀로지
- 무선랜카드
- 따라다니는 배너
- Getrows
- replace
- readonly
- form
- ASP
- ajax
- include
- euc-kr
- jQuery
- SQL Injection
- 크로스 컴파일
- utf-8
- synology
- submit
- FileSystemObject
- println
- XMLHTTP
- RTL88x2BU
- DS718+
- jquery 레이어
- lsusb
- 커널
- AC1300
Archives
- Today
- Total
아는 것이 좋은 것이다.
[Java] 파일 업로드, 임시파일 생성 본문
public void writeFile(MultipartHttpServletRequest file, HttpServletRequest request) throws IOException {
File path = new File(request.getRealPath("/resources/upload/"));
String fileName = file.getFile("filename").getOriginalFilename();
File destination = File.createTempFile("file", fileName, path);
FileCopyUtils.copy(file.getFile("filename").getInputStream(), new FileOutputStream(destination));
System.out.println("filePath: " + destination.getAbsolutePath());
System.out.println("fileName: " + file.getFile("filename").getOriginalFilename());
System.out.println("fileSize: " + file.getFile("filename").getSize());
System.out.println(path.hashCode());
//destination.deleteOnExit(); // 생성된 임시파일 삭제
}
'Java Programing' 카테고리의 다른 글
[Java/JSP] return 없이 웹페이지에 값 보내기 (0) | 2015.01.27 |
---|---|
[Java Programing] 특정 URL로 Json 전송 (0) | 2014.10.29 |
[Java Programing] 배열에 특정값 삭제하기 (2) | 2014.10.24 |
[Java] URL 이미지 다운로드 (0) | 2014.06.09 |
[Java] 자바 로그 저장 (0) | 2014.06.03 |
Comments