久艹网,亚洲一日韩欧美中文字幕2019,国产欧美日韩精品专区黑人,一区二区三区久久99

中山php|最優(yōu)網(wǎng)絡(luò)中山做網(wǎng)站 中山php建站

最優(yōu)良人

Posts Tagged With: file

JS獲取file上傳文件路徑,后綴,大小,文件名

2012/08/16 at 11:58 » Comments (184)

/** *函數(shù)描述:獲取input type=file的圖像全路徑 * @obj input type=file的對象 **/ function getFullPath(obj) { if(obj) { //ie if (window.navigator.userAgent.indexOf("MSIE")>=1) { obj.select(); return document.selection.createRange().text; } //firefox else if(window.navigator.userAgent.indexOf("Firefox")>=1) { if(obj.files) { return obj.files.item(0).getAsDataURL(); } return obj.value; } return obj.value; } }   <input type="file" onchange="document.getElementById('img').src=getFullPath(this);" >   =========================================================================     #判斷IE還是Firefox function getFullPath(obj) { if(obj) { //ie if (window.navigator.userAgent.indexOf("MSIE")>=1) { obj.select(); return document.selection.createRange().text; } //firefox else if(window.navigator.userAgent.indexOf("Firefox")>=1) { if(obj.files) { return obj.files.item(0).getAsDataURL(); } return obj.value; } return obj.value; } }       #判斷后綴名 function yulan(){ var filePath =getFullPath(document.getElementById('UpFile')); var fileText =filePath.substring(filePath.lastIndexOf("."),filePath.length); var ...more »