这段代码中有些错误,我必须在db中上传图像 [英] some error in this code i have to upload images in db
本文介绍了这段代码中有些错误,我必须在db中上传图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Line 27: if (FileUpload1.HasFile)<br />
Line 28: savepath = Path.Combine(Request.PhysicalApplicationPath, imagefoldr);<br />
Line 29: savefile = Path.Combine(savefile, FileUpload1.FileName);<br />
Line 30: FileUpload1.SaveAs(savefile);<br />
Line 31: SqlDataSource1.Insert();<br />
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server=USER\\SQLEXPRESS;user id=;password=database=images");
string imagefoldr = "images";
string savepath;
string savefile;
if (FileUpload1.HasFile)
savepath = Path.Combine(Request.PhysicalApplicationPath, imagefoldr);
savefile = Path.Combine(savefile, FileUpload1.FileName);
FileUpload1.SaveAs(savefile);
SqlDataSource1.Insert();
}
推荐答案
请检查以下链接,这将对您有所帮助:
链接1 [链接2 [
Please check the below links this will help you:
Link 1[^]
Link2[^]
这篇关于这段代码中有些错误,我必须在db中上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文