首页 > 解决方案 > 在提交给 HomeController 之前将 input[type=file] 转换为 Base64

问题描述

如何转换如下所示的 5 个单独的输入:

<form action="uploadImages" method="post" id="frm">
     <input name="Img1" type="file" accept="image/*;capture=camera">
     <input name="Img2" type="file" accept="image/*;capture=camera">
     <input name="Img3" type="file" accept="image/*;capture=camera">
     <input name="Img4" type="file" accept="image/*;capture=camera">
     <input name="Img5" type="file" accept="image/*;capture=camera">
      <input type="submit" value="Submit Form" class="UserSubmit" />
</form>

在发送到 HomeController 之前到 Base64 字符串。

文件类型将只是图像。(PNG/JPG)。

标签: asp.netimageinputtobase64string

解决方案


推荐阅读