Connecting Tech Pros Worldwide Forums | Help | Site Map

File Upload using struts

Newbie
 
Join Date: Sep 2009
Posts: 19
#1: 4 Weeks Ago
Iam trying to upload file using struts but getting "file not found exception" please suggest!!! below is the code

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out;
try {
out = response.getWriter();
} catch (IOException ex) {
ex.printStackTrace();
}
UploadFileForm uff=(UploadFileForm)form;
readExcel xlReader = new readExcel();
FormFile myfile= null;
FileInputStream fs=null;
try {
myfile=uff.getTheFile();
System.out.println(myfile.getFileName());
String path = getServlet().getServletContext().getRealPath("")+"/"+myfile.getFileName();

fs = new FileInputStream(new File(path));
contentReading(fs);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
Newbie
 
Join Date: Sep 2009
Posts: 19
#2: 4 Weeks Ago

re: File Upload using struts


Can someone please help
Reply