hello , i have problem which i need to get path file if i select from my pc. from my code the value that i could get just name of the file not full path of the file. here is my code.
i hope could somebody help me to pass the value input type file from form1.jsp file to attach.jsp file.
form1.jsp
<FORM name="FileForm" ACTION="attach.jsp" METHOD=POST > <br><br><br><center> <table border="0" bgcolor=#ccFDDEE><tr> <td colspan="2" align="center"><B>UPLOAD THE FILE</B> </td> </tr> <tr> <td colspan="2" align="center"> </td> </tr> <tr> <td><b>Choose the file To Upload:</b></td> <td> <INPUT NAME="file1" TYPE="file" > </td></tr> <tr><td colspan="2" align="center"> <input type="submit" value="Send File"> </td> </tr> <tr> </tr> </table> </center> </FORM>
attach.jsp
String filename = request.getParameter("file1"); System.out.println(filename); System.out.println(request.getParameter("email")); DataSource source = new FileDataSource(filename); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(filename); multipart.addBodyPart(messageBodyPart); m.setContent(multipart); // Send the message //transport.send(m); System.out.println("Msg Send ....");