ASP.NET mvc上传多个附件
这里不知道为什么不能发照片,所以请各位大侠麻烦移一下网站帮忙我解答一下这问题。谢谢
http://zhidao.baidu.com/new?word=&ie=GBK asp.net mvc
[解决办法]
这边有代码
这边有demo
[解决办法]
我是用uploadify
View
$(function () {
$("#btnUploadSiteLogo").uploadify({
height: 23,
swf: '/js/uploadify/uploadify.swf',
uploader: '/common/UploadSiteLogo',
formData: { PreSiteID: $("#PreSiteID").val(), MainID: $("#MainID").val() },
buttonText: '选择文件',
fileTypeDesc: '图像文件',
fileTypeExts: '*.jpeg; *.bmp; *.gif; *.jpg; *.png',
fileSizeLimit: '1024KB',
width: 80,
removeTimeout: 0.01,
auto: true,
multi: false,
onUploadSuccess: function (file, data, response) {
if (data == "0") { alert("文件:" + file.name + " 上传失败!"); }
else if (data == "1") { alert("不是允许的上传格式!"); }
else if (data == "2") { alert("超过允许的上传大小!"); }
else if (data == "3") { alert("超过允许的上传数量!") }
else {
$("#imgSiteLogo").attr("src", data);
}
}
});
Controller
public string UploadSiteLogo()
{
try
{
Guid preSiteID = Guid.Parse(Request.Form["PreSiteID"]);
Guid mainID = Guid.Parse(Request.Form["MainID"]);
HttpPostedFileBase file = Request.Files["Filedata"];