hi
As Arun said u have to use Enctype=Multipart/form in the tag form.
Heres a sample of the FORM tag
<form id="frmUpload" name="frmUpload" METHOD="post" ENCTYPE="multipart/form-data">
Use the <FILE> tag for getting the file to be uploaded
The theory is that when u post the form the file to be uploaded goes as header data and u have to manually pluck out the file data from the header from the page to which u have posted it to.
There is a very nice explanation to all this in 15seconds.com.
the code below should do the job
<%
ServletInputStream ip=request.getInputStream();
byte[] tmpbuffer = new byte[8192];
int length=0;
String inputLine=null;
boolean proceed =true;
length = ip.readLine( tmpbuffer, 0, tmpbuffer.length);
inputLine = new String (tmpbuffer, 0, length);
String filename=null;
boolean can_write=false;
FileOutputStream tmpfile=new FileOutputStream("tmpf.txt"); //create a tmpf.txt file on the server
int total_bytes=0,bytes_read=0,k=0;
boolean error=false;
while (proceed)
{
length = ip.readLine( tmpbuffer, 0, tmpbuffer.length);
if(length < 0)
proceed=false;
if(proceed)
{
inputLine = new String (tmpbuffer, 0,length);
StringTokenizer tokenizer=new StringTokenizer(inputLine,";");
while(tokenizer.hasMoreTokens())
{
String subtoken=tokenizer.nextToken();
if(subtoken.startsWith("fil")) //If subtoken starts with file get the file name
{
filename=subtoken.substring(11,subtoken.length()-3);
can_write=true;
}
if(can_write)
{
if(!inputLine.startsWith("Content") && !inputLine.startsWith("----"))
{
tmpfile.write(tmpbuffer,0,length); //write to tmpfile stream
total_bytes+=length;
}
}
}
}
}
Hope find it helpful
Regds
Hemanth