I am receiving this error
I am trying to save an uploaded file to a dynamically created directory, but I keep getting the error aboveCould not find a part of the path
"c:\inetpub\wwwroot\www01\ESPEmail\df268d2c-5666-4171-a4a1-ca703ff3bce7\Test.doc".
Here is my code
VB Code:
Dim Filename As String = "" 'Declare a new directory to be created Dim newDir As New DirectoryInfo(Server.MapPath("EmailAttachments\") & Guid.NewGuid.ToString) 'Grab the name of the file Filename = Path.GetFileName(attachmentFile.PostedFile.FileName) 'Create the new directory newDir.Create() 'Save the uploaded file to the new directory attachmentFile.PostedFile.SaveAs(Server.MapPath(newDir.Name) & "\" & Filename) 'Add the filename to the listbox lstAttachments.Items.Add(Filename)
It creates the new (GUID) directory just fine, it just doesn't save the file to it.
any ideas on how to fix this???




Reply With Quote