日期:2014-05-18  浏览次数:20715 次

如何在org.apache.myfaces.custom.fileupload.UploadedFile获取上穿文件的路径名?
我现在无法在客户端获得上传文件路径名
页面代码:    
<div   id= "fileUploadDiv "   style= "display:none; ">
<h:form   id= "form_fileUpload "   enctype= "multipart/form-data ">
<h:outputText   value= "Choose   File "   />
<t:inputFileUpload   id= "fileupload "
value= "#{fileUploadMgrBean.upFile} "   storage= "file "   styleClass= " "
required= "true "   maxlength= "200000 "   />
<h:commandButton   value= "OK "   action= "#{fileUploadMgrBean.upload} ">
<h:inputHidden   id= "DeviceType "   value= "3000MX "   />
<h:inputHidden   id= "DeviceIP "   value= "#{deviceInfoMgrBean.infoByName.IP} "   />
</h:commandButton>
</h:form>
</div>
javabean代码
public   class   FileUploadMgrBean
{
public   UploadedFile   getUpFile()
{
logger.info( "[ACTION]   -   getUpFile() ");
return   _upFile;
}
public   void   setUpFile(UploadedFile   upFile)
{
System.out.println( "_upFile   =   "+upFile);
_upFile   =   upFile;
}
public   String   upload()   throws   IOException
{
logger.info( "[UPLOAD]   -   filename: "   +   _upFile.getName());//这里只能获取到文件名没有路径名,想在客户端获得文件的路径
}
}

------解决方案--------------------
logger.info( "[UPLOAD] - filename: " + _upFile.getPath());