主题: 上传附件文件名作为说明 + 上传附件自动添加图标
作者: kenanfans, 发布日期: 2012-01-03 14:07:01, 浏览数: 4249

基于4.0.3修改

 

要更改的文件如下:

1.upload_json.ashx

Hashtable hash = new Hashtable();
hash["error"] = 0;
hash["url"] = fileUrl;
hash["filename"] = Path.GetFileName(fileName);//文件名称作为文件说明
hash["ext"] = Path.GetExtension(fileName).Remove(0, 1);//文件类型
context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
context.Response.Write(JsonMapper.ToJson(hash));
context.Response.End();

 

2.insertfile

 

//第13行后增加
imgPath = self.basePath + 'plugins/insertfile/icons/',
imgPreviewPath = self.basePath + 'plugins/insertfile/icons/Preview/',

//第31行变更为
'<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:160px;" /><span style="padding-left:5px;"><img name="imgType" src="' + imgPath + 'blank.gif" /></span></div>',

//titleBox = K('[name="title"]', div),后增加
imgType = K('[name="imgType"]', div);


//urlBox.val(url);后增加
titleBox.val(data.filename);
imgType.attr('src',imgPreviewPath + data.ext + '.gif');

//self.insertHtml(html);的上一行改为
var html = '<a href="' + url + '" data-ke-src="' + url + '" target="_blank"><img src="' + imgType.attr('src').replace(imgPreviewPath, imgPath) + '">' + title + '</a>';

 

 

16*16的图标放在insertfile文件夹下的icons中,32*32的图标放在icons下的preview中

 

 

 

 

作者: 冰水咖啡[30], 发布日期: 2012-01-04 10:53:16
不错,有没有ASP的啊!
回复
发表新帖 发表回复