01-04-2010 05:57 PM
for each (field in formdata.fields) {
logger.log(field.name);
if(field.name == "file" && field.isFile) {
logger.log(field.filename);
logger.log(field.content);
logger.log(field.mimetype);
}
}
if (req instanceof WebScriptServletRequest) {
final WebScriptServletRequest webScriptServletRequest = (WebScriptServletRequest) req;
final HttpServletRequest httpServletRequest = webScriptServletRequest
.getHttpServletRequest();
final FormData formData = new FormData(httpServletRequest);
//Get your files from formData because it is public by the patch:
FormData.FormField[] fields = formData.getFields();
logger.debug("is multipart? "+formData.getIsMultiPart());
for(FormData.FormField field : fields) {
logger.debug("field.getName(): "+field.getName());
if(field.getName().equals("file")) {
String filename = field.getFilename();
Content content = field.getContent();
String mimetype = field.getMimetype();
logger.debug("filename: "+filename);
logger.debug("content: "+content);
logger.debug("mimetype: "+mimetype);
}
}
}
01-06-2010 05:11 PM
FormData formData = (FormData)req.parseContent(); // <– req = WebScriptRequest
FormData.FormField[] fields = formData.getFields();
for(FormData.FormField field : fields) {
logger.debug("field.getName(): "+field.getName());
if(field.getName().equals("file") && field.getIsFile()) {
String filename = field.getFilename();
Content content = field.getContent();
String mimetype = field.getMimetype();
logger.debug("filename: "+filename);
logger.debug("content: "+content);
logger.debug("mimetype: "+mimetype);
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.