Whenever I try to attach any file from HTML page in web browser(either Google chrome or Mozzila) and send to Servlet, I'm getting just getting the name of the file without having it's complete path. If I make an attachment of any file from C drive, I'm not getting it's complete address. And whenever I try to send this file name to mail server, I'm getting an exception:
Caused by: java.io.FileNotFoundException: Hello.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at javax.activation.FileDataSource.getInputStream(Unknown Source)
at javax.activation.DataHandler.writeTo(Unknown Source)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1381)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:852)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:452)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:98)
at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source)
at javax.activation.DataHandler.writeTo(Unknown Source)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1381)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1742)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:737)
... 18 more
How can I get rid of this problem? How to get the complete address of my uploaded file?