[Grails](groovy)--如何實作將下載頁面程式及解決下載檔案名稱亂碼問題

程式如下:

def file =newFile(params.fileDir)    
response
.setContentType("application/octet-stream")
response
.setHeader("Content-disposition","attachment;filename=${file.getName()}")

response
.outputStream << file.newInputStream()// Performing a binary stream copy


文章標籤

PG Levin Li 發表在 痞客邦 留言(0) 人氣()