简体   繁体   中英

How to open the file using FileDialog and display the path into textbox in asp.net mvc?

如何使用FileDialog打开文件并在asp.net mvc中显示文本框的路径?

use <input type="file" name="imageFile" />

on the controller for your POST method include this HttpPostedFileBase imageFile

if (imageFile != null && imageFile.ContentLength > 0)
{
    var fileName = Path.GetFileName(imageFile.FileName);
    var fileExtension = Path.GetExtension(imageFile.FileName);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM