Memnoch1207
Dec 3rd, 2003, 04:21 PM
I am receiving this error
Could not find a part of the path
"c:\inetpub\wwwroot\www01\ESPEmail\df268d2c-5666-4171-a4a1-ca703ff3bce7\Test.doc".
I am trying to save an uploaded file to a dynamically created directory, but I keep getting the error above
Here is my 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???
Could not find a part of the path
"c:\inetpub\wwwroot\www01\ESPEmail\df268d2c-5666-4171-a4a1-ca703ff3bce7\Test.doc".
I am trying to save an uploaded file to a dynamically created directory, but I keep getting the error above
Here is my 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???