Jump to content

sliparJepun

Learning
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by sliparJepun

  1. salam, saya ada masalah dengan ENCTYPE="multipart/form-data". dengan adanya benda alah ni, coding sya xboleh nk request parameter dari form .. ada terbaca dlm forum len kene guna code dri com.oreilly.servlet.MultipartRequest. tp xtahu cara nk guna.. ada saper leh tolong explain..
  2. 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]
×
×
  • Create New...