It gives the following errors
JavaScript critical error at line 22, column 4927 in https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.min.js\n\nSCRIPT1010: Expected identifier
second error
Unhandled exception at line 180, column 9 in http://localhost:1113/Forms/DisplayFiles.aspx
0x800a138f - JavaScript runtime error: Unable to get property 'GlobalWorkerOptions' of undefined or null reference
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Public Class DisplayFiles
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim constr As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
cmd.CommandText = "SELECT Id, Name FROM tblFiles"
cmd.Connection = con
con.Open()
gvFiles.DataSource = cmd.ExecuteReader()
gvFiles.DataBind()
con.Close()
End Using
End Using
End Sub
Protected Sub Upload(sender As Object, e As EventArgs)
Dim filename As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim contentType As String = FileUpload1.PostedFile.ContentType
Using fs As Stream = FileUpload1.PostedFile.InputStream
Using br As New BinaryReader(fs)
Dim bytes As Byte() = br.ReadBytes(CType(fs.Length, Long))
Dim constr As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Dim query As String = "INSERT INTO tblFiles VALUES (@Name, @ContentType, @Data)"
Using cmd As New SqlCommand(query)
cmd.Connection = con
cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = filename
cmd.Parameters.Add("@ContentType", SqlDbType.VarChar).Value = contentType
cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
End Using
End Using
Response.Redirect(Request.Url.AbsoluteUri)
End Sub
<System.Web.Services.WebMethod()>
Public Shared Function GetPDF(ByVal fileId As Integer) As Object
Dim bytes As Byte()
Dim fileName As String, contentType As String
Dim constr As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
cmd.CommandText = "SELECT Name, Data, ContentType FROM tblFiles WHERE Id = @Id"
cmd.Parameters.AddWithValue("@Id", fileId)
cmd.Connection = con
con.Open()
Using sdr As SqlDataReader = cmd.ExecuteReader()
sdr.Read()
bytes = DirectCast(sdr("Data"), Byte())
contentType = sdr("ContentType").ToString()
fileName = sdr("Name").ToString()
End Using
con.Close()
End Using
End Using
Return New With {.FileName = fileName, .ContentType = contentType, .Data = bytes}
End Function
End Class