1
안녕하세요. vaadin을 사용하여 데이터베이스에 파일을 저장하려고합니다. 나는 사용자가 파일을 업로드 할 수있는 웹 응용 프로그램을 가지고 있으며, 지금까지 파일은 내 파일 시스템에 업로드됩니다.데이터베이스를 vaadin에 저장하는 중
public class FileUploader implements Receiver, SucceededListener {
File file;
public OutputStream receiveUpload(String fileName, String mimeType) {
FileOutputStream fos = null;
try {
file = new File("C:\\Documents and Settings\\ABDEN00U\\Desktop\\tmp\\" + fileName);
fos = new FileOutputStream(file);
} catch (final java.io.FileNotFoundException e) {
new Notification("Could not open file", e.getMessage(), Notification.TYPE_ERROR_MESSAGE.ERROR_MESSAGE).show(Page.getCurrent());
return null;
}
return fos;
}
@Override
public void uploadSucceeded(SucceededEvent event) {
// TODO Auto-generated method stub
file_upload.setVisible(true);
file_upload.setSource(new FileResource(file));
}
는 내가 뭘하려고 오전 파일을 잡고 ByteArray에로 변환 내 포스트 그레스 데이터베이스에 업로드되어 여기에 업로드 내 코드입니다. 당신의 uploadSucceeded
방법에서