Csharp/C#教程:C#图片上传效果实例分析分享

本文实例讲述了C#图片上传效果实现方法。分享给大家供大家参考。具体如下:

<%@PageTitle=""Language="C#"MasterPageFile="~/Default.master"AutoEventWireup="true" CodeFile="Default.aspx.cs"Inherits="Default"%> <asp:ContentID="cHead"ContentPlaceHolderID="head"runat="Server"> </asp:Content> <asp:ContentID="cBody"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server"> <asp:Literalrunat="server"ID="ltrHTML"></asp:Literal> <scripttype="text/javascript"> $().ready(function(){ varcounter=0; $(function(){ varbtnUpload=$('#addImage'); newAjaxUpload(btnUpload,{ action:'saveupload.aspx', name:'uploadfile', onSubmit:function(file,ext){ $("#loading").show(); }, onComplete:function(file,response){ varuploadedfile="UserData/"+file; $("#uploadImageWrapper").append("<divclass='imageContaineroffset'id='current"+counter+"'><imgheight='65px'width='65px'src='"+uploadedfile+"'alt='"+uploadedfile+"'/><divid='close"+counter+"'class='close'title='"+uploadedfile+"'onclick='RemoveImage(this);'><a></a></div></div>"); $('#current'+counter).fadeIn('slow',function(){ $("#loading").hide(); $("#message").show(); $("#message").html("Addedsuccessfully!"); $("#message").fadeOut(3000); counter++; }); } }); }); }); functionRemoveImage(_this){ varcounter=_this.id.replace('close',''); $("#loading").show(); $.ajax({ type:"POST", url:"removeupload.aspx", data:"filename="+_this.getAttribute('title'), success:function(msg){ $('#current'+counter).fadeOut('slow',function(){ $("#loading").hide(); $("#message").show(); $("#message").html("Removedsuccessfully!"); $("#message").fadeOut(3000); }); } }); } </script> <tableid="imageUploader"cellpadding="0"cellspacing="0"> <trclass="header"> <tdstyle="padding-left:5px;"> <aid="addImage"href="javascript:;">AddImage</a> </td> </tr> <trclass="body"> <tdvalign="top"> <divid="uploadImageWrapper"> </div> </td> </tr> <trclass="footer"> <td> <divid="loading"style="display:none"> <tablecellpadding="0"cellspacing="0"> <tr> <td> <imgwidth="20"height="20"src="Images/Loading.gif"alt="Loading..."/> </td> <td> Pleasewait... </td> </tr> </table> </div> <divid="message"style="color:Green"> </div> </td> </tr> </table> </asp:Content>

希望本文所述对大家的C#程序设计有所帮助。

您可能感兴趣的文章:c#批量上传图片到服务器示例分享C#实现图片上传(PC端和APP)保存及跨域上传说明c#图片上传和显示的实现方法C#使用Socket上传并保存图片的方法C#实现图片上传与浏览切换的方法基于C#winform实现图片上传功能的方法C#判断上传文件是否是图片以防止木马上传的方法C#保存上传来的图片示例代码c#多图片上传并生成缩略图的实例代码ASP.NET(C#)实现一次性动态上传多张图片的代码(多个文件)C#最齐全的上传图片方法

标签: 图片 图片上传

C语言解数独程序的源码

OpenCV鼠标绘制矩形和截取矩形区域图像

上述就是C#学习教程:C#图片上传效果实例分析分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/907305.html

(0)
上一篇 2021年10月24日
下一篇 2021年10月24日

精彩推荐