You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jeffery Painter <pa...@kiasoft.com> on 2003/06/17 16:16:04 UTC
Re: Using Turbine to delete a file....
I handle it this way... I'm still using TDK 2.1 but this should work for
you.
public void doDelete(RunData data, Context context)
throws Exception
{
Criteria criteria = new Criteria();
// uploaded file entry is stored in the database, retrieve with
// details to path of file on system
criteria.add(PortfolioPeer.PORTFOLIO_ID, data.getParameters().getInt("portfolioid"));
// clean up the file from our local file system
Portfolio entry = (Portfolio) PortfolioPeer.doSelect(criteria).elementAt(0);
File f = new File( TurbineServlet.getRealPath( entry.getImageName() ) );
if (f.exists()) {
// perform the delete operation
f.delete();
}
// remove database entry of file information
PortfolioPeer.doDelete(criteria);
}
HTH,
Jeff Painter
On Tue, 17 Jun 2003, Wilson, Allen wrote:
> Good morning...
>
> I am deploying the Jetspeed Portal system for my company and one of the
> things I am working on is a File Transfer system for clients to upload
> and download files. I have the upload working fine using the
> turbine.util.upload.FileItem.
>
> My problem comes when I want to provide the functionality for the user
> to delete an upload file. I found a the deleteFile method as part of the
> FileHandler class but it says that the method has been deprecated for
> the TurbineUploadService counterpart FileItem. I looked up this class
> (or at least thought I did) but could not find any reference for
> deleting a file. Could someone provide some insight or direction on
> which method/class/object to use to delete a file.
>
> Thanks.....Allen
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org