This commit is contained in:
Frederic Debuire
2007-12-14 14:56:17 +00:00
parent d63ab989b7
commit 223f641939

View File

@@ -0,0 +1,20 @@
package org.yacos.web.utils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
public class FileUploadAction extends AbstractAction {
protected Event doExecute(RequestContext context) throws Exception {
MultipartFile file = context.getRequestParameters().getRequiredMultipartFile("file");
if (file.getSize() > 0) {
// data was uploaded
context.getFlashScope().put("file", new String(file.getBytes()));
return success();
} else {
return error();
}
}
}