[英]Saving an ASP image with base64 src using C#
I have this image: 我有这张图片:
<img id="mainPage_ChildContent1_img1" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEHN+sQHPrBZ5O4/2Q==">
src value reduced to preserve space in the example. 减少src值以保留示例中的空间。
The original asp image control is declared this way: 原始的asp图像控件是这样声明的:
<asp:Image runat="server" ID="img1"/>
The image is loaded through jQuery input type file in the image control. 图像是通过图像控件中的jQuery输入类型文件加载的。
I want to know how I can save the image to a file with C# once the user will click a save button. 我想知道一旦用户单击保存按钮,如何使用C#将图像保存到文件中。
ImageUrl property is null, what are my options to get the src in image object in C# code behind? ImageUrl属性为null,要在C#代码中获取图像对象中的src,我有哪些选择?
You can save your src in a input type hidden with Jquery. 您可以将src保存为Jquery隐藏的输入类型。
Example 例
function storeImgsrc(){
$("#hiddenid").val($("#imgid").src());
}
After that you can create a Bitmap or File in C#. 之后,您可以在C#中创建位图或文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.