salam, problem sy ialah cmne nk dapat path file. cmner dari form nk pass value input type file ke dalam jsp.
saya gune request.getParameter tp error. ada sesiapa yg boleh tolong ??
saya nk baca url file untuk attach file dlm email guna jsp.
[u]form1.jsp[/u]
[code] <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> [/code]
[u]attach.jsp[/u]
[code]
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);
System.out.println("Msg Send ....");
transport.sendMessage(m,m.getAllRecipients());
transport.close();[/code]