FileUpload using Jsp
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, April 12, 2001 12:08 AM

Sir, For File Ipload,I have written Html code and click submit and action goes to a JSP page where I want to copy the file from client to Server. I have given my code below: It is working locally but if I give Http: it is not working Please solve the problem JSP CODE <% String fName = request.getParameter("ffile");//FROM html page int i = fName.lastIndexOf(""); String file_name = fName.substring(++i); int g,len,ctr=0; char s1; try { FileInputStream f1 = new FileInputStream(fName); FileOutputStream f2 = new FileOutputStream("c:\javawebserver2.0\system"+file_name); // PATH WHERE FILE HAS TO   More>>

Sir,
For File Ipload,I have written Html code and click submit and action goes to a JSP page where I want to copy the file from client to Server.
I have given my code below:
It is working locally but if I give Http: it is not working
Please solve the problem

JSP CODE

<%
String fName = request.getParameter("ffile");//FROM html page
int i = fName.lastIndexOf("");
String file_name = fName.substring(++i);
int g,len,ctr=0;
char s1;
try
{
FileInputStream f1 = new FileInputStream(fName);
FileOutputStream f2 = new FileOutputStream("c:\javawebserver2.0\system"+file_name);
// PATH WHERE FILE HAS TO BE UPLOADED
// HERE IF HTTP://199.899.788.16:8080
//SYSTEM/"+FILE_NAME is given it
//puts error file not found
len = f1.available();
while(ctr
{
g=f1.read();
f2.write(g);
ctr++;
}
f1.close();
f2.close();
}
catch(Exception ioe)
{System.out.println(ioe); }
%>

   <<Less
About | Sitemap | Contact