首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

哪位高手知道RadUpload怎么使用

2012-08-25 
谁知道RadUpload如何使用这个控件以前没有用过只会使用原始的控件进行上传上传按钮的事件如下:if (fulDoc.

谁知道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
[解决办法]
不知道楼主对于上传的需求是如何的 不一定非要用这个控件 有时候开发项目最好准备多套解决方案 以备用



[解决办法]

探讨

就是一个简单的上传功能,如果用自带的FileUpload用上面的方法可以上传成功,但是AJAX的控件都不行,错误是hasfile方法没有,我刚刚在元数据里面没有,我想问一下到底是这个控件没有这个方法,还是我的控件不完整

热点排行