Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Vb.net problems trouble.., ASP.NET:Could not find a part of path

views
     
TSjai1210
post Feb 20 2006, 12:25 AM, updated 19y ago

Getting Started
**
Junior Member
63 posts

Joined: Mar 2005
From: ss2, petaling jaya


Hi, I'm doing a basic file upload in asp.net (I've done this many times), and I'm getting an error that I can't seem to find a problem to.


TSjai1210
post Feb 20 2006, 12:32 AM

Getting Started
**
Junior Member
63 posts

Joined: Mar 2005
From: ss2, petaling jaya


Following is my vb.net coding:

Private Sub Upload()


Dim FilePath As String = Server.MapPath("Documents\")


strFileNamePath = myFile.PostedFile.FileName
intFileNameLength = InStr(1, StrReverse(strFileNamePath), "\")
strFileNameOnly = Mid(strFileNamePath, _
(Len(strFileNamePath) - intFileNameLength) + 2)



Test = Right(strFileNameOnly, _
strFileNameOnly.Length - _
strFileNameOnly.IndexOf(".") - 1)



myFile.PostedFile.SaveAs(FilePath & (strFileNameOnly))
' Yust a message to the client.

lblFileContentType.Text = "The content is: " _
& myFile.PostedFile.ContentType

End Sub
TSjai1210
post Feb 20 2006, 12:34 AM

Getting Started
**
Junior Member
63 posts

Joined: Mar 2005
From: ss2, petaling jaya


Hope someone can help me solve this problems...

The following is the error message display out every time after i upload
Could not find a part of the path "c:\inetpub\wwwroot\WebApplication8\Documents\WMES3314-revision_Q.doc".


Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path "c:\inetpub\wwwroot\WebApplication8\Documents\WMES3314-revision_Q.doc".]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +287
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
System.Web.HttpPostedFile.SaveAs(String filename)
WebApplication8.WebForm1.Upload() in c:\inetpub\wwwroot\WebApplication8\WebForm1.aspx.vb:82
WebApplication8.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication8\WebForm1.aspx.vb:39
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()



sinx
post Feb 21 2006, 08:54 PM

New Member
*
Junior Member
15 posts

Joined: Aug 2005


Are you sure c:\inetpub\wwwroot\WebApplication8\Documents\WMES3314-revision_Q.doc is correct?
lmcckl
post Feb 22 2006, 12:53 AM

Getting Started
**
Junior Member
50 posts

Joined: Dec 2005
From: KL


try replace the '\' with '/' or '\\'

 

Change to:
| Lo-Fi Version
0.0116sec    0.49    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 08:41 PM