Click to See Complete Forum and Search --> : How to get the file content in the server, posted using <input type=file>
September 29th, 1999, 04:18 AM
Hi folks,
i have one form that will send the client file to the server. The html code for this is
<form action="httt://servlet:8080/servlet/upload" Method= POST enctype="multipart/form-data">
<input type=file name=file_name>
<input type=submit>
</form>
I dont know how to get the file content in the server server side using servlets.
Do please let me know. My id is xavier_wilson@hotmail.com
Thanks in advance
wilson.
meherss
September 30th, 1999, 02:10 PM
See this code..
Posted some time back by Leon
//(the class base64 encodes the attachment, there is just attachment without any message body)
out.println("DATA");
out.flush();
line = in.readLine(); //354 ...
if(!line.startsWith("354"))
{
System.out.println("ERROR: DATA");
return;
}
//message:
out.println("From: " + fromName + " <" + from + ">");
out.println("Reply-To: " + from);
out.println("X-Mailer: Java SMTP v1.0");
out.println("MIME-Version: 1.0");
out.println("To: " + to);
out.println("Subject: " + subject);
out.println("Content-Type: multipart/mixed; boundary="+(char)34+"=============0123456789=="+(char)34);
out.println("");
out.println("This is a multi-part message in MIME format.");
out.println("");
out.println("--=============0123456789==");
out.println("Content-Type: application/octet-stream; name="+(char)34+filename+(char)34);
out.println("Content-Transfer-Encoding: base64");
out.println("Content-Disposition: attachment; filename="+(char)34+filename+(char)34);
out.println("");
base64 mm=new base64(attachment,attlen,out);
out.println("--=============0123456789==--");
out.println(".");
out.flush();
Hope this gives you some clues...
Meher
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.