如何在数据库中上传图像路径,因为数据库字段类型是varchar [英] how to upload image path in database because database field type is varchar
本文介绍了如何在数据库中上传图像路径,因为数据库字段类型是varchar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在数据库中上传图片路径并在文件夹中上传通过Linq到sql.HOW?
解决方案
试试这样:
尝试
{
< pre lang = cs> var productPath = Server.MapPath( 〜/ App_Upload /产品跨度>);
fuImage.SaveAs(Path.Combine(productPath,fileName));)+ fileName);
}
catch (Exception exc)
{
dvMessage.InnerHtml = WebUtil.CreateAlert(WebUtil.NotifyMessage.Warning ,& quot;İşlemBaşarısız!& quot;,& quot;ResimDosyasıeklerkenhataoluştu.HATA:& quot; + exc.Message);
return ;
} < / pre > < /跨度>
how to upload image path in database and image in folder through Linq to sql.HOW?
解决方案
Try like this:
try { <pre lang="cs">var productPath = Server.MapPath("~/App_Upload/Product"); fuImage.SaveAs(Path.Combine(productPath, fileName));) + fileName); } catch (Exception exc) { dvMessage.InnerHtml = WebUtil.CreateAlert(WebUtil.NotifyMessage.Warning,"İşlem Başarısız!", "Resim Dosyası eklerken hata oluştu. HATA:" + exc.Message); return; }</pre>
这篇关于如何在数据库中上传图像路径,因为数据库字段类型是varchar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文