FileUploder使用jQuery获取文件的完整路径 [英] FileUploder get file full path using jquery

查看:54
本文介绍了FileUploder使用jQuery获取文件的完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码获取完整的文件路径

I use below code for getting full file path

我的问题是在firefox中使用file.value仅获取我的文件名,但在获取文件完整路径的情况下

My problem is using file.value in firefox only get my file name but in ie it get file full path

 function setImage(file) {        
        document.getElementById('prevImage').src = file.value;        
}
  <asp:FileUpload ID="fup" runat="server" onchange="setImage(this);" />
  <img id="prevImage" height="200" width="200"></img>

推荐答案

< inpu type ="file"/> 是大多数浏览器甚至都不支持更改的元素之一样式,因为涉及安全性.每个浏览器都有自己的安全实施级别.

<inpu type="file" /> is a one of those elements which most browser even wont enable to change the style because of the security implications. Each browser has it's own level of security implementation.

我不知道为什么IE会向您提供完整的路径,因为它要上传到的网站不需要该信息

I don't know why IE is providing you the full path, when the website to which it is uploading does not need that information

我看不到为什么您可能需要用户在服务器端放置文件的位置(完整路径)的原因,并且Firefox不提供完整路径是一件好事.

I don't see a reason why you may want the users file location(full path) on the server side, and it is a good thing that firefox is not providing the full path.

这篇关于FileUploder使用jQuery获取文件的完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆