/*进度条框*/ .shangchuantishikuang { border: 7px solid #74A5BF; background-color: white; font-size: 14px; color: #666666; font-family: 'Microsoft YaHei'; position: fixed; top: 170px; left: 700px; width: 400px; padding: 10px; padding-left: 0px; padding-top: 0px; z-index: 10000; }
#region 图片上传 [AcceptVerbs(HttpVerbs.Post)] public JsonResult Upload(HttpPostedFileBase fileData) { if (fileData != null) { try { //1.拼接图片路径 var fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fileData.FileName); //2.上传到阿里云 //3.返回结果 return Json(new { Success = true, FileName=fileName }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { Success = false, Message ="error"}, JsonRequestBehavior.AllowGet); } } else { return Json(new { Success = false, Message = "fail" }, JsonRequestBehavior.AllowGet); } } #endregion
//上传图片 function inital(id, text, s) { //进度框 $("#fileQueue").hide(); $('#' + id).uploadify({ 'buttonText': text, 'queueID': 'fileQueue', 'fileTypeDesc': '请选择图片', //允许上传的文件后缀 'fileTypeExts': '*.gif; *.jpg; *.png', 'swf': '/Scripts/uploadify-v3.1/uploadify.swf?rom=' + Math.random(), 'uploader': '/Controller/Upload?rom=' + Math.random(), 'onUploadSuccess': function (file, data, response) { //文件上传成功时处理 eval("data=" + data); }); }