日期:2014-05-17  浏览次数:20397 次

谁知道RadUpload如何使用
这个控件以前没有用过
只会使用原始的控件进行上传
上传按钮的事件如下:
if (fulDoc.HasFile)
  {
  bool HasType = false;
  bool HasSize = false;
  string typeId = "";
  string fileType = System.IO.Path.GetExtension(fulDoc.FileName).ToString().ToLower();
  DataTable fileTypeList = bllDocumentType.GetList(" DTExtension = '" + fileType + "' ").Tables[0];
  if (fileTypeList.Rows.Count > 0)
  {
  HasType = true;
  if (fulDoc.PostedFile.ContentLength / 1024 <= int.Parse(fileTypeList.Rows[0]["DTCapacity"].ToString()))
  {
  HasSize = true;
  typeId = fileTypeList.Rows[0]["DTId"].ToString();
  }
  }
  if (false == HasType)
  {
  Response.Write("<script>alert('不合法的文件类型!');</script>");//不合法的文件类型
  return;
  }
  if (false == HasSize)
  {
  Response.Write("<script>alert('文件大小超出范围!');</script>");//文件大小超出范围
  return;
  }
  string saveName = System.IO.Path.GetFileNameWithoutExtension(fulDoc.FileName.ToString());
  string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + fileType;
  string filePath = "../UploadFiles/Document/" + System.DateTime.Now.ToString("yyyyMM") + "/" + fileName;
  bool hasDirectory = System.IO.Directory.Exists(Server.MapPath("../UploadFiles/ProfessionProject/" + System.DateTime.Now.ToString("yyyyMM") + "/"));
  if (hasDirectory)
  {
  fulDoc.SaveAs(Server.MapPath(filePath));
  }
  else
  {
  System.IO.Directory.CreateDirectory(Server.MapPath("../UploadFiles/Document/" + System.DateTime.Now.ToString("yyyyMM") + "/"));
  fulDoc.SaveAs(Server.MapPath(filePath));
  }
  modelDocument.MIId = bllDocument.CreateId();
  modelDocument.DTId = typeId;
  modelDocument.UserId = typeId;
  modelDocument.MIName = saveName;
  modelDocument.MIPath = filePath;
  bllDocument.Add(modelDocument);

  //文件上传完成
  Response.Write("<script>alert('文件上传完成!');</script>");//文件上传完成
  }
  else
  {
  Response.Write("<script>alert('请先选择文件!');</script>");//请先选择文件
  return;
  }
  }
但是用了新的控件就会出错。。。
新控件的名字是fulDoc
求指教

------解决方案--------------------
提示什么错误?
------解决方案--------------------
使用例子
http://demos.telerik.com/aspnet-ajax/upload/examples/customizingraduploadui/defaultcs.aspx


http://demos.telerik.com/aspnet-ajax/upload/examples/clientsidevalidation/defaultcs.aspx
------解决方案--------------------
不知道楼主对于上传的需求是如何的 不一定非要用这个控件 有时候开发项目最