0
我遵循這個問題的解決方案Preview an image before it is uploaded顯示用戶想要提交到我的網站的圖像預覽。將瀏覽器內存中的圖像保存到服務器中
我有這樣的代碼,顯示
頁上的圖像預覽<input type="file" accept="image/*" onchange="loadFile(event)">
<img id="output"/>
<script>
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>
,並與一些額外的數據形成。
我的問題是,當用戶點擊提交表單按鈕時,如何將圖像保存到我的webapp的/ uploads /文件夾?我不需要將圖像保存在數據庫中,而是保存在文件夾中的Web服務器上。
[上傳文件,ASP.NET MVC(http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx/) –