By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

file upload problem

P: 11
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"

Expand|Select|Wrap|Line Numbers
  1. If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
  2.     Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
  3.     Dim SaveLocation As String = Server.MapPath("Classifieds") & "\" & fn
  4.     Try
  5.         FileUpload1.PostedFile.SaveAs(SaveLocation)
  6.         lblRes.Text = "The file has been uploaded."
  7.     Catch Exc As Exception
  8.         lblRes.Text = "Error: " & Exc.Message
  9.     End Try
  10. Else
  11.     lblRes.Text = "Please select a file to upload."
  12. End If
  13.  
Please help me out to solve this problem and what changes I have to in the code.
Nov 26 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
You didn't tell us which line throws the error.
Nov 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.