图片使用cshtml删除/删除代码语法(base64图像)

时间:2019-02-22 04:36:01

标签: javascript c# asp.net-mvc razor model-view-controller

如何放置删除图标以从数据库记录中删除base64图像记录?我已附加了图片上传器的CSHTML部分和该上传器的Javascript。我还附加了数据库记录的屏幕截图。顺便说一句,我正在使用C#MVC。预先感谢您的帮助。

页面 Screenshot of the page

数据库记录 Database record screenshot

function Picture_Upload(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
            $('#Form_Account #PICTURE').val(e.target.result);
        };
        reader.readAsDataURL(input.files[0]);
        $("#lable_file").html($(input).val().split("\\").splice(-1, 1)[0] || '@Language_List.Where(x => x.KEYWORD == "No_File_Chosen").First().VALUE');
    }
}
<div class="col-lg-4 well well-sm">

  Account Picture
  <br /> @if (!String.IsNullOrEmpty(Model.PICTURE)) {
  <img src='@Model.PICTURE' style="max-width:100%;max-height:100%" /> } else {
  <img src="~/img/Logo_Blank.png" style="max-width:100%;max-height:100%;" /> }

  <br /><br />

  <div class="Toggle_Form_Account" style="display:none; width:100%">
    @*<input id="file_upload" type="file" accept="image/gif, image/jpeg, image/png" onchange="Picture_Upload(this);" />*@
    <button type="button" onclick="document.getElementById('file_upload').click()">@Language_List.Where(x => x.KEYWORD == "Choose_File").First().VALUE</button> <label for="file_upload" id="lable_file" style="font-weight: normal !important;">@Language_List.Where(x => x.KEYWORD == "No_File_Chosen").First().VALUE</label>
    <input id="file_upload" type="file" style="display:none" accept="image/gif, image/jpeg, image/png" onchange="Picture_Upload(this);" />
  </div>

0 个答案:

没有答案