View Single Post
  #1 (permalink)  
Old 07-07-2008, 08:57 AM
jazz2k8's Avatar
jazz2k8 jazz2k8 is offline
Senior Member
 
Join Date: Apr 2008
Posts: 112
jazz2k8 is on a distinguished road
[SOLVED] File is Not Moving
i wants to move a file from one location to another location , Here is my code
Quote:
import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class upload extends HttpServlet
{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {


response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
String path=request.getParameter("Jazz");
File f=new File(path);
String s=f.getAbsolutePath();
File file = new File(s);

// Destination directory
File dir = new File("D:\\moved");

// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
System.out.println("File is not moved");
}



}
}
Can you help me...
__________________
visit :
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote
Sponsored Links