私は vaadin で最初のアプリケーションを開発しています。今、アップロード コンポーネントをカスタマイズしようとしています。要約すると、画像のアップロードを行う必要があります。
今、私のコンポーネントは標準的な方法で実装されています:
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
}
サーバー上の一時ファイルを使用せずにドキュメントのアップロードを行うことができるかどうかお尋ねしたいと思います。
どのようにできるのか?