Html helper for <input type=“file” />

后端 未结 8 1993
予麋鹿
予麋鹿 2020-11-28 18:16

Is there a HTMLHelper for file upload? Specifically, I am looking for a replace of


using ASP.NET

相关标签:
8条回答
  • 2020-11-28 19:16

    You can also use:

    @using (Html.BeginForm("Upload", "File", FormMethod.Post, new { enctype = "multipart/form-data" }))
    { 
        <p>
            <input type="file" id="fileUpload" name="fileUpload" size="23" />
        </p>
        <p>
            <input type="submit" value="Upload file" /></p> 
    }
    
    0 讨论(0)
  • 2020-11-28 19:16

    I had this same question a while back and came across one of Scott Hanselman's posts:

    Implementing HTTP File Upload with ASP.NET MVC including Tests and Mocks

    Hope this helps.

    0 讨论(0)
提交回复
热议问题