繁体   English   中英

使用 ajax 将 Base64 图像发布到 Blazor controller

[英]Post Base64 image with ajax to Blazor controller

I'm trying to post a base64 image with Ajax to Blazor controller, the problem is that on the controller side I always get null, while on the ajax side I can see in formdata that there is valid base64 string sent.

Ajax:

 var form = new FormData();
    form.append("base64image", blobHref)

    $j.ajax({
        type: "POST",
        url: "/TestController/HostPicture",
        data: form,
        processData: false,
        contentType: false,
    });

Controller:

    [HttpPost("HostPicture")]
    public async Task<IActionResult> AddPrintFileToHost(string fileBase64)
    {
        var a = fileBase64;
        return Ok(a);
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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