2015-10-13 62 views

回答

-1
String filePath = fileDomainObject.filePath 
boolean fileSuccessfullyDeleted = new File(filePath).delete() 
if(fileSuccessfullyDeleted){ 
    fileDomainObject.delete flush:true 
} 
else{ 
    flash.error = "Error in deletion." 
    return 
} 
2

刪除文件是如此簡單 -

def file = new File(/C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg/) 
file.delete() 
相關問題