How can i delete the i file i've been upload
Dear Java'ers
I have been use the file upload using
http://wiki.opensymphony.com/display/WW/Webwork+2+file+upload+handling
http://wiki.opensymphony.com/display/WW1/File+Upload+Interceptor
Its done to upload file to C:/upload (For example)
But i have a problem with delete file.
What should i do to delete file ?
[356 byte] By [
half_human] at [2007-9-30 17:34:51]

Hi. I havent gone through the links that you provided, but if it is simply a matter of deleting a file on the server, you can use the File.delete method. Something like this would do:
File flTmp = new File("your-filename");
flTmp.delete();
.travis.
> Hi. I havent gone through the links that you provided,
> but if it is simply a matter of deleting a file on the
> server, you can use the File.delete method. Something
> like this would do:
>
> > File flTmp = new File("your-filename");
> flTmp.delete();
>
>
> .travis.
Where do i put this code above ?
In FileUploadInterceptor.java ?
It all depends how you plan to delete the file. If you are going to allow the user to delete the file by selecting it from a JSP page, you would normally put the code in a bean and then invoke the bean method.
If on the other hand, you want to delete the files without user intervention (probably, after they have existed for some period of time), you can put the code within a servlet. This servlet would periodically check the upload directory for old files and delete them.
travis311279 can u give me a sample form to delete file ?
i hope u be patient with me, because i'm newbie in java :)
For example i have uploaded 2 file : test1.doc & test2.txt in C:\jakarta-tomcat-4.1.29\webapps\Sample\upload
Now in my delete form, i want to view the file i've been upload (test1.doc & test2.txt) If i check the file, so.. the following that i checked is delete.
Please give me a sample to callme_harry@yahoo.com
I would thanks for it
Hi,
You haven't written how actually you would like to delete the files. As mentioned in my previous post, there could be a couple of places where you could put the code.
travis
PS: I dont think it is a good idea to include your personal email ids in the forum. The forum by itself is a very good platform to discuss issues.