求一段FileUpload上传图片或文本附件 到SQL2000 数据库的代码 谢谢!在线等 解决散分 求一段FileUpload上传图片或文本附件 到SQL2000 数据库的代码 谢谢!在线等 解决散分要求根据上传附件类型 判断类型 然后把图片或文本插入到数据库中image或text字段 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if (this.FileUpload1.HasFile)//如果第一个控件有文件 { string name = this.FileUpload1.FileName;//获取上传文件名 string ipath = Server.MapPath("updata" + "\\" + name);//获得实际路径 nic.Access = "updata\\" + name;//传到数据库里的虚拟路径 string type = this.FileUpload1.PostedFile.ContentType; if (type == "image/gif" || type == "image/pjpeg" || type == "application/octet-stream" || type == "application/zip" || type == "application/msword" || type == "application/vnd.ms-excel" || type == "text/plain" || type == "application/pdf") { try { this.FileUpload1.SaveAs(ipath); } catch (Exception ee) { this.Label4.Text = ee.Message.ToString(); return; } } else { Response.Write("<script>alert('上传的文件类型不对,请重新选择!')</script>"); //this.Label4.Text = "上传的文件类型不对,请重新选择"; return; } } 你好,能把 (插入数据库的字段 )[ 求一段FileUpload上传图片或文本附件 到SQL2000 数据库的代码 谢谢!在线等 解决散分 要求根据上传附件类型 判断类型 然后把图片或文本插入到数据库中image或text字段] 的代码发给我吗? 谢谢, 反驳眼镜哥对我的误解-------再谈谈C#和Java 用SQL语句写一个触发器 winform 中在一个窗体中改变另一个窗体控件的值!! 有没有什么办法判断远程主机没有开启(UDP) 请同情一下初学者,分少请帮忙!!!!!!! winform下修改XML文件出错,请大家帮帮忙 如何将.net程序直接编译成机器代码? 如何进行WPD开发,MTP模式下便携设备内文件的读写。谢谢 MD5加密 本公司高薪诚聘有大型网站设计管理经验的项目主管及经理,所在地上海 sql 查询重复数据的问题 用户控件如何调用Form里的方法?
{
string name = this.FileUpload1.FileName;//获取上传文件名
string ipath = Server.MapPath("updata" + "\\" + name);//获得实际路径
nic.Access = "updata\\" + name;//传到数据库里的虚拟路径
string type = this.FileUpload1.PostedFile.ContentType;
if (type == "image/gif" || type == "image/pjpeg" || type == "application/octet-stream" || type == "application/zip" || type == "application/msword" || type == "application/vnd.ms-excel" || type == "text/plain" || type == "application/pdf")
{
try
{
this.FileUpload1.SaveAs(ipath);
}
catch (Exception ee)
{
this.Label4.Text = ee.Message.ToString();
return;
}
}
else
{
Response.Write("<script>alert('上传的文件类型不对,请重新选择!')</script>");
//this.Label4.Text = "上传的文件类型不对,请重新选择";
return;
} }