Problem with HttpPostedFile

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mcarrera00@gmail.com

    #1

    Problem with HttpPostedFile

    Hi,

    I have a problem with uploading files to a webserver.
    Here it's the code

    Dim strPath As String = MapPath(fileNam e).ToLower

    strPath = strPath.Replace ("\usercntrl s", "\uploads")

    fileUpload.Post edFile.SaveAs(s trPath)

    usercntrls is where the control resides on the server, upload is the
    destination where the file is supposed to be saved. When the problem
    occurs, the file gets saved in usercntrls, rather than in uploads.
    What drives me nut is that sometimes the file is saved in the proper
    location, sometimes not. It should not be a problem of permissions,
    and if the file exists, it should be overwritten. Sometimes it get
    fixed recompiling the application and uploading the dlls...

    Any idea?

    Thanks a lot!

    Marco.

  • mcarrera00@gmail.com

    #2
    Re: Problem with HttpPostedFile

    Dim strPath As String = MapPath(fileNam e).ToLower
    >
    strPath = strPath.Replace ("\usercntrl s", "\uploads")
    >
    fileUpload.Post edFile.SaveAs(s trPath)
    I forgot to mention, before this code:

    Dim fileName As String =
    System.IO.Path. GetFileName(fil eUpload.PostedF ile.FileName)

    fileUpload is the name of the control.

    Regards.

    Comment

    Working...