You could try this code
strFileNamePath = FileUpload_sylbus.PostedFile.FileName
strFileNameOnly = Path.GetFilename(strFileNamePath)
Dim newFileNamePath as String = Path.Combine("D:\OLMS", strFileNameOnly)
Dim br As New BinaryReader(FileUpload_sylbus.PostedFile.InputStream)
FileUpload_sylbus.PostedFile.SaveAs(newFileNamePath)
Now, if you still get errors in accessing the folder D:\OLMS
then you have this path outside the root folder of your site and your machine configuration (search about MEDIUM TRUST) disallows writing outside the root folder. (Of course I am assuming that the folder D:\OLMS
exists and the user under which the IIS ASP.NET service is running has all the permissions to write in that folder)
manpreet
Best Answer
2 years ago