问题
I use below code for getting full file path
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>
回答1:
<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.
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
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.
来源:https://stackoverflow.com/questions/8147317/fileuploder-get-file-full-path-using-jquery