sasi kals wrote:Hi i want to upload a file to the tomcat webapps i done like below
<code>
<%@ page import="java.util.*,java.io.*"%>
<%
String path = request.getParameter("filename");
String newPath = "";
int count = 0;
if (path != null) {
ArrayList arr = new ArrayList();
StringTokenizer st = new StringTokenizer(path, "\\");
while (st.hasMoreTokens()) {
arr.add(count, st.nextToken());
count++;
}
String Path = request.getRealPath("");
System.out.println("------------->" + Path);
newPath = Path + "\\upload\\" + arr.get(count - 1);
int c;
FileInputStream fis = new FileInputStream(path);
FileOutputStream fos = new FileOutputStream(newPath);
while ((c = fis.read()) != -1) {
fos.write((char) c);
}
fos.flush();
fos.close();
}
out.println("1.File Uploaded from :: " + path);
out.println("<br>");
out.println("<br>");
out.println("2.Uploaded File is Saved in :: " + newPath);
%>
</code>
And this is running well in a single system. but i want to do it with many client.
like when the tomcat is running in one system. now i want to upload a file from some other system to the that system where tom cat is running.please help me ..
thanks in advance..