关于Chrome中上传文件得到绝对路径的方法

来源:百度知道 编辑:UC知道 时间:2024/05/07 14:23:36
我想用JavaScript做上传图片的预览功能,但是在Chrome和Safari里面都得不到本地图片的绝对路径。不知道 有没有什么办法可以解决这个问题的。
话说,原来的不行,现在可以用HTML5的 FileReader,Chrome里拿不到绝对路径但是可以做图片预览。

擦~ 3年前的问题。。。

代码(只粘贴了关键代码):
<form name="thisform" method="post"
action="<%=request.getContextPath()%>/movieManage.do" id="thisform" enctype="multipart/form-data">
<input type="file" name="theFile" onchange="document.getElementById('theFilePath').value=this.value"/>
<input type="hidden" id="theFilePath" name="theFilePath" value="">
</form>
注意:要有enctype="multipart/form-data"
Action代码:String filePath = request.getParameter("theFilePath");
filePath既是上传文件的绝对路径。

我目前只找到了IE、FF下的解决方法,其他浏览器都暂时没有好的方案。

没办法
继续IE吧

我也在找这个答案,关注...