回复 2楼holly.huang的帖子
C1Upload 可以通过前台抓取文件的上传完成事件,可以在前台时间中调用Service 来获取修改文件名。设置方法如下:
后台代码:
- this.C1Upload1.OnClientChange = "selectfile";
- this.C1Upload1.OnClientComplete = "uploadcomplete";
- this.C1Upload1.OnClientTotalComplete = "totaluploadcomplete";
复制代码
前台代码
- <script type="text/javascript">
- function selectfile(event) {
- //获取文件后缀
- var filename = event.currentTarget.value;
- var extension = filename.substring(filename.lastIndexOf(".") + 1);
- if (!(extension == "rar" || extension == "txt" || extension == "doc"
- || extension == "pdf" || extension == "zip")) {
- alert("请上传格式为 rar、txt、doc、pdf、zip 格式的文件。");
- return false;
- }
- }
- function totaluploadcomplete() {
- alert("所有文件上传成功。");
- }
- function uploadcomplete() {
- alert("当前文件上传成功。");
- document.location.reload();
- }
- </script>
复制代码
指定上传路径属性为:
- this.C1Upload1.TempFolder = "Temp";
- this.C1Upload1.TempFolder = "UploadedFiles";
复制代码 |