加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

jQuery Ajax File Upload实例源码

发布时间:2020-12-15 23:22:29 所属栏目:百科 来源:网络整理
导读:本文实例为大家分享了jQuery Ajax File Upload实例源码,供大家参考,具体内容如下 项目结构 Default.aspxUpload.aspxScripts/…style.css 效果图 客户端html代码 !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xht

本文实例为大家分享了jQuery Ajax File Upload实例源码,供大家参考,具体内容如下

项目结构

Default.aspx Upload.aspx Scripts/… style.css

效果图

客户端html代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head runat="server">

').appendTo('#files').html('
' + file).addClass('success'); } else { $('
  • ').appendTo('#files').text(file).addClass('error'); } } }); });

    // --></mce:script>

    Upload File

      服务端处理代码Upload.aspx

      namespace JqueryAjaxUploadTest
      {
      public partial class Upload : System.Web.UI.Page
      {
      protected void Page_Load(object sender,EventArgs e)
      {
      try
      {
      HttpPostedFile hpfFile = Request.Files["uploadfile"];
      hpfFile.SaveAs(Server.MapPath("~/uploads/") + hpfFile.FileName);
      Response.Write("success");
      }
      catch (Exception)
      {

          Response.Write("fail"); 
        } 
      } 

      }
      }

      以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

      (编辑:李大同)

      【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

        推荐文章
          热点阅读