hi
i am using the apache fileupload itself
my html code is
upload.html
---------------
<html>
<head>
<title>Upload File...</title>
</head>
<body>
<FORM name="loadfile" ACTION="file_upload1.jsp" ENCTYPE="multipart/form-data" METHOD="POST">
<table width="87%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="21%"> </td>
<td width="40%">Which file do you want to upload ?......</td>
<td width="12%"><INPUT TYPE=FILE NAME=fileload></td>
<td width="27%"> </td>
<td width="0%"> </td>
</tr>
<tr>
<td> </td>
<td>Select the Category to upload file .......</td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="select_load" >
<option value="io">I/O</option>
<option value="memory">Memory</option>
<option value="testchips">
Test Chips</option>
<option value="stdcell">Standard Cell</option>
<option value="general">General</option>
</select>
</font></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><INPUT name="SUBMIT" TYPE=SUBMIT></td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></p>
<p><BR>
</p>
</FORM>
</body>
</html>
jsp page is
file_upload1.jsp
--------------------
<%@ page import="java.util.*,java.io.*,org.apache.commons.fileupload.*" %>
<HTML>
<BODY>
<%
String cat_load="";
String loadtext="";
if(request.getParameter("select_load")!=null)
{
cat_load=(String)((request.getParameter("select_load")).trim());
}
out.print("...........1"+cat_load+"<br>");
out.print(cat_load.equalsIgnoreCase("General"));
if(cat_load.equalsIgnoreCase("general"))
{
out.println("inside if");
try {
out.print("inside try</b><br>");
// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();
// Set upload parameters
// set memory size allowed to the uploading (optional)
// upload.setSizeThreshold(2000);
// set a directory to temporarily upload the file if
// the last memory size in insufficient (optional) :
// upload.setRepositoryPath("c:/temp");
// set the max uploaded file size (-1 for no max size)
upload.setSizeMax(-1);
// Parse the request
List items = upload.parseRequest(request);
// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext())
{
FileItem item = (FileItem) iter.next();
if (item.isFormField())
{
// the item is not a file item
String name = item.getFieldName();
String value = item.getString();
out.print("item :<b>"+name+"</b> value:<b>"+value+"</b><hr>");
}
else
{
// the item is a file item
String fieldName = item.getFieldName();
String fileName = item.getName();
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
out.print("item :<b>"+fieldName+"</b><br>");
out.print(" file :<b>"+fileName+"</b><br>");
out.print(" content type :<b>"+contentType+"</b><br>");
out.print(" in memory ? :<b>"+isInMemory+"</b><br>");
out.print(" size:<b>"+sizeInBytes+"</b> bits<br>");
out.print("fileName :<b>"+fileName+"</b><br>");
fileName = fileName.substring(fileName.lastIndexOf("\\")+1);
out.print("fileName :<b>"+fileName+"</b><br>");
String destFile="\\\\server1\\temp\\"+fileName;
out.print(" destFile:<b>"+destFile+"</b><br>");
// copy the file to disk
File uploadedFile = new File(destFile);
item.write(uploadedFile);
out.print(" file uploaded to : <b>"+ destFile +"<br>");
}
}//while end
}//try end
catch (FileUploadBase.SizeLimitExceededException e)
{
out.print("COMMONS error : maximum file size exceeded");
}
catch (FileUploadException e)
{
out.print("COMMONS error :"+ e.toString());
}
catch (Exception e)
{
out.print("error :"+ e.toString());
}
}
%>
</BODY>
</HTML>
jsut check out these and let me know
waiting for ur reply
regards
santosh