Results 1 to 5 of 5

Thread: Saving uploaded file error

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861

    Saving uploaded file error

    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
    VB Code:
    1. Dim Filename As String = ""
    2.  
    3. 'Declare a new directory to be created
    4. Dim newDir As New DirectoryInfo(Server.MapPath("EmailAttachments\") & Guid.NewGuid.ToString)
    5.  
    6. 'Grab the name of the file
    7. Filename = Path.GetFileName(attachmentFile.PostedFile.FileName)
    8.  
    9. 'Create the new directory
    10. newDir.Create()
    11.  
    12. 'Save the uploaded file to the new directory
    13. attachmentFile.PostedFile.SaveAs(Server.MapPath(newDir.Name) & "\" & Filename)
    14.  
    15. 'Add the filename to the listbox
    16. 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???
    Last edited by Memnoch1207; Dec 3rd, 2003 at 05:51 PM.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width