0
사용자의 컴퓨터에서 사진을 찍어 내 서버에 업로드하는 버튼이있는 데 관심이 있습니다.바아 진 업로드 기능
나는 서버 업로드 부분을 해결할 수 있었지만 사용자 컴퓨터에서 경로를 처리하는 데 어려움이 있습니다. Vaadin Upload는 완전한 경로를 제공하지는 않지만 동적이되고 싶습니다. 문서를 보면, 그들은 임시 위치를 사용하지만, 구현 방법을 모른다. 나는 파일 선택기 닫을 때 내 서버에 넣을 수 있도록, 내가 파일 경로 또는 핸들러의 어떤 종류를 얻을 것을 기대하고 있습니다
public OutputStream receiveUpload(String filename,
String mimeType) {
// Create upload stream
FileOutputStream fos = null; // Stream to write to
try {
// Open the file for writing.
file = new File("/tmp/uploads/" + filename);
fos = new FileOutputStream(file);
} catch (final java.io.FileNotFoundException e) {
new Notification("Could not open file<br/>",
e.getMessage(),
Notification.Type.ERROR_MESSAGE)
.show(Page.getCurrent());
return null;
}
return fos; // Return the output stream to write to
}
.
해결되었지만/tmp/uploads에 업로드하려고했지만 권한이 없습니다. –