我的看法 gsp index.gsp
<head>
<meta name="layout" content="main">
<title>Upload file and fullpath</title>
</head>
<div id="upload-data" class="content scaffold-create" role="main">
<div class="content scaffold-create" role="main">
<h1>Upload file and full path</h1>
<g:if test="${flash.message}"><div class="message" role="status">${flash.message}</div></g:if>
<g:uploadForm action="fullpath">
<fieldset class="form">
<input type="file" name="file" />
</fieldset>
<fieldset class="buttons">
<g:submitButton name="Upload" value="Upload" />
</fieldset>
</g:uploadForm>
</div>
我的控制器 Uploadfullpath
package library
class UploadfullpathController {
def index() { }
def fullpath(){
def files = request.getFile('file')
def fullpath=files.getProperties()
System.out.println("full path is : "+ fullpath)
}
}
我需要在本地磁盘上获取文件的完整路径,例如 ( c: /folder1/notes.txt ) 或 ( f : /folder2/note2.txt )**