07-21-2008 12:04 PM
public void execute(WebScriptRequest req, WebScriptResponse res)
throws IOException
{
try
{
HttpServletRequest httpReq = ((WebScriptServletRequest)req).getHttpServletRequest();
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = upload.parseRequest(httpReq);
res.getWriter().write("no items: "+items.size());
Iterator iter = items.iterator();
while(iter.hasNext())
{
FileItem item = (FileItem)iter.next();
if(item.isFormField())
{
res.getWriter().write("\nIs Form Field");
res.getWriter().write("\nField Name: "+item.getFieldName());
}
else
{
res.getWriter().write("\nIs Uploaded File");
res.getWriter().write("\nField Name: "+item.getFieldName());
}
}
}
catch(Exception e)
{
res.getWriter().write("Error in processing web service\n\n"+
e.getMessage()+"\n\n"+
e.getStackTrace()+"\n\n"+
e.getCause()+"\n\n"+
"error class= "+e.getClass());
}
}
07-25-2008 06:50 AM
The following example allows the user to upload an HTML document for validation:
<FORM METHOD=post ACTION="/cgi-bin/validate.cgi" ENCTYPE="multipart/form-data">
<P>Select an HTML document to upload and validate. If your browser does not support form-based file upload, use one of our <A HREF="methods.html">alternate methods of validation</A>.</P>
<P><INPUT TYPE=file NAME="html_file" ACCEPT="text/html"></P>
<P><INPUT TYPE=submit VALUE="Validate it!"></P>
</FORM>
07-30-2008 04:44 AM
08-11-2008 07:59 AM
08-19-2008 05:53 PM
08-21-2008 02:39 AM
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.