3 回答

TA貢獻123條經驗 獲得超103個贊
對于input file?各個瀏覽器獲取的值不同。。
ie的老版本可以獲取完整路徑,現在很多瀏覽器從安全角度考慮,已經不能獲取完整路徑了 。。
沒有路徑自然就沒辦法顯示 了。
結合后端才可以吧?。

TA貢獻29條經驗 獲得超13個贊
把div改成label,或直接在div的外面加一層label都行。
另外,你可以把input隱藏起來,用css——style="display: none;"。你可以給div設置任何喜歡的樣式了。
在div中顯示你上傳的圖片要用js來做,這個你可以到網上查查。
把div改成label
<label style="border: 5px solid #af0; overflow: hidden; position: relative; display: inline-block; width: 100px; height: 30px; background: #0fa;?border-radius: 70% 0;">
<input type="file" ?id="file" ?accept="image/*" style="display: none;"?/>
</label>
div的外面加一層label
<label>
????<div?style="border: 5px solid #af0; overflow: hidden; position: relative; display: inline-block; width: 100px; height: 30px; background: #0fa;?border-radius: 70% 0;">
????<input type="file" ?id="file" ?accept="image/*"?style="display: none;"?/>
????</div>
</label>
添加回答
舉報