OK, I've got the uploading working by changing the date format in the SQLFileStorage.cs to UK format dates and the image is being saved to the database and displayed fine in the image selector. Trouble now is my downloadimage page isn't returning the image!!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dt As DateTime
Dim filename As String
Dim filesize As Integer
Dim filedata As Byte()
Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("northernLeague").ConnectionString)
conn.Open()
Dim fileid As Integer = Integer.Parse(Request.QueryString("fileid"))
Using comm As New SqlCommand("aspnet_League_GetMediaItem", conn)
comm.CommandType = CommandType.StoredProcedure
comm.Parameters.Add(
"MediaID", SqlDbType.Int).Value = Convert.ToInt32(fileid)
Using reader As SqlDataReader = comm.ExecuteReader()
If Not reader.Read() Then
Throw (New HttpException(404, " File Not Found "))
End If
dt = reader.GetDateTime(reader.GetOrdinal(
"Createdt"))
filename = reader.GetString(reader.GetOrdinal(
"Filename"))
filesize = reader.GetInt32(reader.GetOrdinal(
"Filesize"))
filedata =
CType(reader("Filedata"), Byte())
End Using
End Using
End Using
Response.ClearHeaders()
'Response.ContentType = "image/gif"
Response.AddHeader(
"Content-Length", filesize.ToString())
Response.BinaryWrite(filedata)
Response.End()