FileItem |
Methods |
|
|
copyFile현재 파일을 복사합니다.
Syntaxvoid copyFile ()
void copyFile ( String saveDirPath ) void copyFile ( String saveDirPath, String fileName ) void copyFile ( String saveDirPath, String fileName, boolean overwrite ) ParameterssaveDirPath [in] 복사할 파일의 경로를 입력합니다. fileName [in] 복사할 파일의 이름을 입력합니다. overwrite [in] 파일 복사 시 겹쳐쓰기 모드를 설정합니다. 기본 값은 false입니다.
Return Values복사된 파일의 경로를 반환합니다.
Remarks
Sample CodesJava FileUpload fileUpload = new FileUpload(request, response); try { fileUpload.setAutoMakeDirs(true); String saveDirPath = request.getRealPath("/"); saveDirPath += ("UploadDir" + File.separator); fileUpload.startUpload(saveDirPath); FileItem fileItem = fileUpload.getFileItem("files"); if(fileItem != null) { fileItem.save(saveDirPath); saveDirPath += ("copy" + File.separator); String copiedFilePath01 = fileItem.copyFile(saveDirPath, fileItem.getLastSavedFileName()); String copiedFilePath02 = fileItem.copyFile(saveDirPath, fileItem.getLastSavedFileName()); } } catch(CrossUploaderException ex) { } catch(Exception ex) { fileUpload.deleteUploadedFiles(); } finally { fileUpload.clear(); }
|