Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting files in jsp  RSS feed

 
Santhana Lakshmi.S
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I uploaded some images in the server using jsp.
I stored the file in a folder within the server.
I want to delete those files from server.For that i used the following piece of code,but it is not working

File f = new File("path where the file is stored");
FileInputStream fstream = new FileInputStream(f);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
br.close();
fstream.close(); //new
if(f.delete()) //new
{
out.println("file deleted");
}

Can anyone help me in this?
Thanx a lot in advance
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but it is not working

What does this mean? Are there any exception? If so, which ones, and in which line?
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try this:


Best regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!