本文介绍了图像路径上传到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将图像路径从应用程序更新到我的数据库时,它显示错误.欢迎您提供任何帮助.
在此先感谢
hi ,
when i am updating image path from application to my database it shows the error.any help is appreciated.
Thanks in advance
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path ''D:\Admin Site\ReCon\PRODIMAGES\''.
Source Error:
Line 170: string srvpat = Server.MapPath("/PRODIMAGES/") + filename;
Line 171: if (!File.Exists(Server.MapPath("/PRODIMAGES/") + filename))
Line 172: BrandUploadImg.SaveAs(Server.MapPath("/PRODIMAGES/") + filename);
Line 173: string uploadfilename = NormalImage.ImageUrl;// "/PRODIMAGES/" + filename;
Line 174: CompanyInfoBL.UpdateManufacturer(Convert.ToInt32(manfid), newmanfname, newmanfurl);
Source File: D:\Admin Site\ReCon\UI\CompanyInfo.aspx.cs Line: 172
Stack Trace:
[DirectoryNotFoundException: Could not find a part of the path ''D:\Admin Site\ReCon\PRODIMAGES\''.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +224
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +1142
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +78
System.IO.FileStream..ctor(String path, FileMode mode) +71
System.Web.HttpPostedFile.SaveAs(String filename) +99
System.Web.UI.WebControls.FileUpload.SaveAs(String filename) +23
ReCon.UI.CompanyInfo.UpdateBrandInfo(Object sender, EventArgs e) in D:\Admin Site\ReCon\UI\CompanyInfo.aspx.cs:172
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
推荐答案
if (Directory.Exists(yourPath)) {
//Do your job here.
}
--Amit
--Amit
这篇关于图像路径上传到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!