How can I show text and HTML with image extracted from DB.
-
I have used article on how to save and show image from db: http://www.codeproject.com/aspnet/fileupload.asp?target=upload|image|database The form tag is set to
I have tried to extract text and the image from db. I can see the image but not the text. I guess the form tag attribute enctype has something to do with this. Can anyone help me. Runar
-
I have used article on how to save and show image from db: http://www.codeproject.com/aspnet/fileupload.asp?target=upload|image|database The form tag is set to
I have tried to extract text and the image from db. I can see the image but not the text. I guess the form tag attribute enctype has something to do with this. Can anyone help me. Runar
In ASP.NET you really don't have to worry about multipart form data, unlike in ASP. Can you post some code please so that we can see how you are setting the form up and trying to access the data. regards, Paul Watson Bluegrass South Africa Brian Welsch wrote: "blah blah blah, maybe a potato?" while translating my Afrikaans. Crikey! ain't life grand?
-
In ASP.NET you really don't have to worry about multipart form data, unlike in ASP. Can you post some code please so that we can see how you are setting the form up and trying to access the data. regards, Paul Watson Bluegrass South Africa Brian Welsch wrote: "blah blah blah, maybe a potato?" while translating my Afrikaans. Crikey! ain't life grand?
Form I use:
I can now see that I can still view my image without multipart form, thanks. I'm not able to see my text fields / submit button with the image from DB. Here is the show ShowTheImage function: private void ShowTheImage(int FileID) { // Define SQL select statement string SQL = "SELECT FileSize, FileData, ContentType FROM tblFile WHERE FileID = " + FileID.ToString(); // Create Connection object SqlConnection dbConn = new SqlConnection("server=runar;database=ImgDb;user=sa"); // Create Command Object SqlCommand dbComm = new SqlCommand(SQL, dbConn); // Open Connection dbConn.Open(); // Execute command and receive DataReader SqlDataReader dbRead = dbComm.ExecuteReader(); // Read row dbRead.Read(); // Clear Response buffer Response.Clear(); // Set ContentType to the ContentType of our file Response.ContentType = (string)dbRead["ContentType"]; // Write data out of database into Output Stream Response.OutputStream.Write((byte[])dbRead["FileData"], 0, (int)dbRead["FileSize"]); // Close database connection dbConn.Close(); // End the page Response.End(); } Runar