Or, use:

String sep = File.separator;
if(new File(sep+"tmp"+sep+data.getFileName()).delete())
{
   out.writeObject("File Deleted");
} else {
   out.writeObject("File Not Deleted");
}




                    "Raghupathy, Gurumoorthy"
                    <[EMAIL PROTECTED]        To:     
[EMAIL PROTECTED]
                    -INTL.COM>                            cc:
                    Sent by: "A mailing list for          Subject:     Re: Deleting 
files from a servlet
                    discussion about Sun
                    Microsystem's Java
                    Servlet API Technology."
                    <[EMAIL PROTECTED]
                    >


                    10/05/2001 10:37 AM
                    Please respond to "A mailing
                    list for discussion about Sun
                    Microsystem's Java
                    Servlet API Technology."






u are using /tmp/ which is a unix file system directory sturcture...
change ur logic and make it to c:\temp\lksdflsjdlfjl....

guru
-----Original Message-----
From: Sohaila Roberts [mailto:[EMAIL PROTECTED]]
Sent: 05 October 2001 15:29
To: [EMAIL PROTECTED]
Subject: Deleting files from a servlet


Hello, I have a servlet that deletes a file from the server that the
servlet runs on. The servlet is called from an applet. When I run this
function on a linux box everything works fine and the file is deleted from
the server and db entries relation to where the file is and its id are
deleted. But when I run this from a window's box (windows 98 to be
specific) with either IE5.5 or Netsape 4.75 the file is not deleted from
the server but the database cmds are preformed fine. The code i'm using to
delete the file from the server in my servlet is

if(new File("/tmp/"+data.getFileName()).delete())
{
   out.writeObject("File Deleted");
} else {
   out.writeObject("File Not Deleted");
}

Is there anything specific to do to make this code work on windows?

Thanks
Sohaila

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to