如何删除像chrome,safari,opera这样的webkit浏览器中的c fakepath?如何删除像chrome,safari,opera这样的webkit浏览器中的c fakepath?
在IE和Firefox这是只显示文件名,这是确定
但在Chrome,歌剧,Safari浏览器。这是显示C:\ fakepath \ 700.jpg
我如何删除Chrome,歌剧,Safari浏览器中的C:\ fakepath \。
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js"></script>
<style type="text/css">
.inputWrapper {
overflow: hidden;
position: relative;
cursor: pointer;
/*Using a background color, but you can use a background image to represent a button*/
background-color: #DDF;
}
.fileInput {
cursor: pointer;
height: 100%;
position:absolute;
top: 0;
right: 0;
/*This makes the button huge so that it can be clicked on*/
font-size:50px;
}
.hidden {
/*Opacity settings for all browsers*/
opacity: 0;
-moz-opacity: 0;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)
}
</style>
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$(function() {
$(".inputWrapper").mousedown(function() {
var button = $(this);
button.addClass('clicked');
setTimeout(function(){
button.removeClass('clicked');
},50);
});
$('input[type=file]').change(function() {
var $this = $(this);
$this.parent().find('span').text($this.val());
});
});
});//]]>
</script>
<div class="inputWrapper" id="inputWrapper" style="height: 56px; width: 128px;">
<input class="fileInput hidden" type="file" name="file2"/>
<span></span>
</div>
的可能重复[使用jQuery来获取文件输入的不带路径选择的文件名(http://stackoverflow.com/questions/6365858/use-jquery-to-get-the-file-inputs-selected-filename-without-the-path) –
请检查答案并将其标记出。 – Fusion