当前位置:Gxlcms > JavaScript > 基于jQuery通过jQuery.form.js插件实现异步上传_jquery

基于jQuery通过jQuery.form.js插件实现异步上传_jquery

时间:2021-07-01 10:21:17 帮助过:3人阅读

本文主要从前台和后台代码分析了jquery.form.js实现异步上传的方法,分享给大家,具体代码如下

前台代码:

@{
 Layout = null;
}



 
 

后台代码:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace IceMvc.Controllers
{
 public class UploadController : Controller
 {
  //
  // GET: /Upload/

  public ActionResult Index()
  {
   return View();
  }

  [HttpPost]
  public ActionResult Upload()
  {
   var filesList = Request.Files;
   for (int i = 0; i < filesList.Count; i++)
   {
    var file = filesList[i];
    if (file.ContentLength > 0)
    {
     if (file.ContentLength > 5242880)
     {
      return Content("

以上就是针对jquery.form.js实现异步上传的方法,希望对大家的学习有所帮助。

人气教程排行