Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
Protected Sub btnadd_sylbus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnadd_sylbus.Click Dim extension As String = System.IO.Path.GetExtension(FileUpload_sylbus.PostedFile.FileName).ToLower() Dim Type As String = Nothing If (extension = ".pdf") Then Dim intFileNameLength As Integer Dim strFileNamePath As String Dim strFileNameOnly As String strFileNamePath = FileUpload_sylbus.PostedFile.FileName intFileNameLength = InStr(1, StrReverse(strFileNamePath), "\") strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2) Dim br As New BinaryReader(FileUpload_sylbus.PostedFile.InputStream) FileUpload_sylbus.PostedFile.SaveAs("D:\OLMS\" & strFileNameOnly) cmd.CommandText = "INSERT into Syllabus(sylbus_id, sylbus_name, file_name, content) values(@id,@name,@file,@cont)" cmd.Connection = cn cmd.Parameters.Add("@id", txtsylbus_id.Text) cmd.Parameters.Add("@name", txtsylbus_name.Text) cmd.Parameters.Add("@file", FileUpload_sylbus.FileName) cmd.Parameters.Add("@cont", br.ReadBytes(FileUpload_sylbus.PostedFile.ContentLength)) cmd.ExecuteNonQuery() cn.Close() lbladd_sylbus.Visible = True lbladd_sylbus.Text = "File Upload Success." txtsylbus_id.Text = Nothing txtsylbus_name.Text = Nothing Else lbladd_sylbus.Visible = True lbladd_sylbus.Text = "Not a Valid file format" End If End Sub
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)
D:\OLMS
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.