eWebeditor编辑器上传图片的设置程序
protected void Button1_Click(object sender, EventArgs e)
{
if (this.uploadfile.PostedFile.FileName.Equals(""))
{
return;
}
else
{
string _flag = Request["flag"];
string _regex = "";
switch (_flag)
{
case "img":
_regex = @"^.+\.(jpe?g|gif)$";
break;
case "flash":
_regex = @"^.+\.(swf)$";
break;
case "media":
_regex = @"^.+\.(wmv|avi|rmvb|mpeg|mov)$";
break;
case "file":
_regex = @"^.+\.(rar|zip|doc|pdf|txt)$";
break;
default:
_regex = @"^.+\.(jpe?g|gif|swf|wmv|avi|rmvb|mpeg|mov|rar|zip|doc|pdf|txt)$";
break;
}
Regex test = new Regex(_regex);
if (test.IsMatch(uploadfile.PostedFile.FileName) == true)
{
ClientScriptManager cs = Page.ClientScript;
string imagesfolder = ConfigurationManager.AppSettings["imagesfolder"].ToString();
string filename = Common.UpLoadFile(uploadfile, imagesfolder);
string apurl = Request.Url.ToString();
string apurl2 = Request.CurrentExecutionFilePath;
string tempurl = apurl.Substring(0, apurl.IndexOf(apurl2));
string appurl = Request.ApplicationPath;
string hurl;
if (appurl.Length == 1)
hurl = appurl + filename.Replace("~/", "");
else
hurl = "/" + filename.Replace("~/", "");
hurl = hurl.Replace("路径1", "路径2");
string imgpreview = tempurl + hurl;
imgpreview = imgpreview.Replace("路径1", "路径2");
cs.RegisterClientScriptBlock(this.GetType(), "tt", "parent.document.all('divProcessing').style.display='none';parent.document.all('d_width').value='550';parent.document.all('d_height').value='341';parent.document.all('imgPreview').src='" + imgpreview + "';parent.document.all('Hurl').value='" + hurl + "';parent.document.all('d_fromurl').value='';", true);
lblinfo.Text = "文件上传成功!<a href=\"\">重新上传</a>";
}
else
{
lblinfo.Text = "您上传的文件类型不正确!<a href=\"\">重新上传</a><script>parent.document.all('divProcessing').style.display='none';</script>";
}
}
}
eWebeditor编辑器上传图片的设置程序的更多相关文章
- eWebeditor编辑器上传图片路径错误解决方法[疑难杂症]【转,作者:unvs】
做了一个多版本的网站,后台用的编辑器是eWebeditor,NET版,后面发现上传图片或者文件之后,路径错误无法显示,必须手工修改才行.. 为了更清楚的说明问题,我下面会说的比较详细,首先是网站文件框 ...
- IIS7 发现无法显示ewebeditor编辑器成空白
vs2003写的网站,很早了,编辑器用的是ewebeditor,每次更换程序编辑器都会出问题.今天记录一下. 内部老网站在Windows2003 iis6上运行的. 现在要迁移到2008上64位.08 ...
- vue问题四:富文本编辑器上传图片
vue使用富文本编辑器上传图片: 我是用的是wangEditor 富文本编辑器 demo:http://www.wangeditor.com/ 1).安装依赖:npm install wangedit ...
- AgileFontSet迅捷字体设置程序
AgileFontSet迅捷字体设置程序-用户手册 AgileFontSet的完整代码,参见 https://www.cnblogs.com/ybmj/p/11683291.html 1.程序特点和 ...
- WPF 设置程序开机自动运行(+注册表项)
#region 设置程序开机自动运行(+注册表项) RegistryKey rgkRun = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Micr ...
- CICS中设置程序常驻内存
CICS中设置程序常驻内存 Permanent=no 修改为Permanent=yse --------------------- 对CICS的参数进行调节,RD中
- 设置程序版本等信息(可直接修改pro文件设置,但是更推荐使用rc文件设置)
Qt版本:5.2.0 在.pro文件中设置版本等信息 VERSION = 1.2.3 QMAKE_TARGET_PRODUCT = 产品名称QMAKE_TARGET_COMPANY = 公司QMAKE ...
- 使用Ueditor编辑器上传图片总结;
今天使用Ueditor编辑器上传图片一直出问题,在网上找了多种方法,最后总结如下: Ueditor编辑器是百度开发的编辑器,要在jsp页面添加Ueditor编辑器,需要以下几步: (1)到 http: ...
- 富文本编辑器上传图片需要配置js,后台代码
富文本编辑器上传图片需要配置js,后台代码
随机推荐
- 【转】PowerDesigner使用方法小结
本文转自:http://www.cnblogs.com/afarmer/archive/2012/11/05/2755327.html PowerDesigner多用来进行数据库模型设计,具有SQL语 ...
- Delphi经验总结(1)
先人的DELPHI基础开发技巧 ◇[DELPHI]网络邻居复制文件 uses shellapi; copyfile(pchar('newfile.txt'),pchar('//computername ...
- iOS的runtime(转)
1. 什么是runtime 运行时刻是指一个程序在运行(或者在被执行)的状态.也就是说,当你打开一个程序使它在电脑上运行的时候,那个程序就是处于运行时刻.在一些编程语言中,把某些可以重用的程序或者实例 ...
- SimpleDataFormat格式
public class SimpleDateFormat extends DateFormat SimpleDateFormat 是一个以国别敏感的方式格式化和分析数据的具体类. 它允许格式化 (d ...
- MFC RadioButton
添加一组RadioButton 多个radio button,IDC_RADIO1,IDC_RADIO2,IDC_RADIO3 ..将IDC_RADIO1的Group属性选择上,其他不要选Group属 ...
- CSS-Transform-transition-Animation
Transform 根据我的理解,transform和width.height.background一样,都是dom的属性,不同的是它是css3旗下的,比较屌,能够对原来的dom元素进行移动.缩放.转 ...
- Http协议之Request和Response
GET / HTTP/1.1表示向服务器用GET方式请求首页,使用HTTP/1.1协议 Cache-Control作用: 用来指定Response-Request遵循的缓存机制.各个指令含义如下Cac ...
- python基础——使用list和tuple
python基础——使用list和tuple list Python内置的一种数据类型是列表:list.list是一种有序的集合,可以随时添加和删除其中的元素. 比如,列出班里所有同学的名字,就可以用 ...
- caffe 无GPU 环境搭建
root@k-Lenovo:/home/k# sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-d ...
- 6.原型模式(Prototype Pattern)
using System; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { // 孙 ...