使用Uploadify上传文件 [英] file upload using Uploadify
本文介绍了使用Uploadify上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一些示例代码
使用Uploadify在mvc上传文件
< br $>
谢谢,
Subhranshu
Please i want some sample code for
uploading a file in mvc using Uploadify
Thanks,
Subhranshu
推荐答案
使用jQuery插件上传到Asp.net MVC [ ^ ]
在ASP.Net MVC应用程序中使用uploadify [ ^ ]
MVC中的多个文件上传使用上传 [ ^ ]
MVC文件上传 - 使用上传与ASP.NET MVC 2/3 [ ^ ]
< a href =http://bobcravens.com/2010/02/upload-files-with-progress-using-uploadify/>使用Uploadify上传带有进度的文件 [ ^ ]
和更多...... [ ^ ]
Using jQuery Plugin Uploadify with Asp.net MVC[^]
Using uploadify in ASP.Net MVC application[^]
Multiple file upload in MVC using Uploadify[^]
MVC File Upload - Using Uploadify with ASP.NET MVC 2 / 3[^]
Upload Files With Progress Using Uploadify[^]
And many more...[^]
<link href="~/Uploadify/uploadify.css" rel="stylesheet" />
<script src="~/Uploadify/jquery-1.4.1.js"></script>
<script src="~/Uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script src="~/Uploadify/swfobject.js"></script>
this is my controller Class
public ActionResult UploadAsync()
{<<br mode="hold" />var model = new ListingModel();
List<string> imgNames;
if (Session["images"] == null)
{
imgNames = new List<string>();
}
else
{
imgNames = (List<string>)Session["images"];
}
string name = string.Empty;
if (Request.Files.Count > 0)
{
List<string> exts = new List<string>();
exts.Add(".gif");
exts.Add(".jpg");
exts.Add(".jpeg");
exts.Add(".bmp");
var file = Request.Files[0];
if (exts.Contains(System.IO.Path.GetExtension(file.FileName).ToLower()))
{
Random rnd = new Random();
name = rnd.Next(111, 9999).ToString() + "_" + System.IO.Path.GetFileName(file.FileName);
imgNames.Add(name);
string fullPath = Path.Combine(Server.MapPath("~/Content/AdImages"), name);
file.SaveAs(fullPath);
Session["images"] = imgNames;
}
else
{
name = "error";
}
// model.Images = imgNames;
}
return Json(name, JsonRequestBehavior.AllowGet);
}
this is the javascript
<script type="text/javascript">
(document).ready( function (){
(document).ready(function () {
这篇关于使用Uploadify上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文