View Single Post
  #8 (permalink)  
Old January 28th, 2008, 03:46 PM
hdpark hdpark is offline
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I made file upload codes as follows.
1. When I run it at local PC with "FileUpload1.SaveAs("\UserFiles\" & FileUpload1.FileName)", it is working fine.
2. When I run it at hosting site(discountasp.net), it gives error "is not rooted". Would you please advise me what codes I should use?

Thanks,
HD


    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("\UserFiles\" & FileUpload1.FileName)
                lblUpload.Text = "File name: " & _
                   FileUpload1.PostedFile.FileName & "<br>" & _
                   "File Size: " & _
                   FileUpload1.PostedFile.ContentLength & " kb<br>" & _
                   "Content type: " & _
                   FileUpload1.PostedFile.ContentType
            Catch ex As Exception
                lblUpload.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            lblUpload.Text = "You have not specified a file."
        End If
    End Sub