file upload problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahemeen
    New Member
    • Sep 2007
    • 11

    file upload problem

    hi all
    I have a page where i upload image file to web server and my code is as follows
    but when i upload it give error as follow:
    "Access to the path "D:\WEBDATA\... .\....." deneid"

    Code:
      If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
                Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
                Dim SaveLocation As String = Server.MapPath("Classifieds") & "\" & fn
                Try
                    FileUpload1.PostedFile.SaveAs(SaveLocation)
                    lblRes.Text = "The file has been uploaded."
                Catch Exc As Exception
                    lblRes.Text = "Error: " & Exc.Message
                End Try
            Else
                lblRes.Text = "Please select a file to upload."
            End If
    plz help me out to solve this problem and what changes i have to in the code.
  • PulkitZery
    New Member
    • Jun 2007
    • 35

    #2
    Looks like it is security issue.

    You need to make sure that you have write permission to the directory where you are tying to save the file.

    Comment

    • rahemeen
      New Member
      • Sep 2007
      • 11

      #3
      thanx for the reply

      i checked on ftp folder it has chmode =666 which means read & write permission is there. but i couldnot upload file.

      plz let me know how to overcome this issue.

      Comment

      Working...