Error uploading a file or image when adding a post entry.

Topics: ASP.NET 2.0
Oct 5, 2007 at 1:37 PM
I'm trying to upload an image when i'm in the add entry screen and i'm getting the following error.... can anyone point me in the right direction? I should have full access to the app_data folder.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not find a part of the path 'c:\hosting\webhost4life\member\kv4s\blog\app_data\files\alertsm.gif'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\hosting\webhost4life\member\kv4s\blog\app_data\files\alertsm.gif'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


DirectoryNotFoundException: Could not find a part of the path 'c:\hosting\webhost4life\member\kv4s\blog\app_data\files\alertsm.gif'.
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1971376
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) +998
System.IO.FileStream..ctor(String path, FileMode mode) +65
System.Web.HttpPostedFile.SaveAs(String filename) +87
adminentry.btnUploadImageClick(Object sender, EventArgs e) +138
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


Oct 6, 2007 at 12:10 PM
Edited Oct 6, 2007 at 12:25 PM
Your problem looks like you dont have the directory "files" created. When you deployed BlogEngine.NET for the first time, this directory is not created you must do it first. Then you dont have to give to anyone full access just the users needed to have write acces to App_Data.
My french blog :
http://www.sodevlog.fr/asp.net.blog/
Oct 6, 2007 at 5:29 PM
That was it!
Thanks!