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 gives an error as follows:
"Access to the path "D:\WEBDATA\... .\....." denied"
[CODE=vbnet]
If Not FileUpload1.Pos tedFile Is Nothing And FileUpload1.Pos tedFile.Content Length > 0 Then
Dim fn As String = System.IO.Path. GetFileName(Fil eUpload1.Posted File.FileName)
Dim SaveLocation As String = Server.MapPath( "Classified s") & "\" & fn
Try
FileUpload1.Pos tedFile.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
[/CODE]
Please help me out to solve this problem and what changes I have to in the code.
I have a page where I upload image file to web server and my code is as follows
but when I upload it gives an error as follows:
"Access to the path "D:\WEBDATA\... .\....." denied"
[CODE=vbnet]
If Not FileUpload1.Pos tedFile Is Nothing And FileUpload1.Pos tedFile.Content Length > 0 Then
Dim fn As String = System.IO.Path. GetFileName(Fil eUpload1.Posted File.FileName)
Dim SaveLocation As String = Server.MapPath( "Classified s") & "\" & fn
Try
FileUpload1.Pos tedFile.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
[/CODE]
Please help me out to solve this problem and what changes I have to in the code.
Comment