So I have this code:
if ((uplImage.FileName != ""))
{
byte[] raw = new byte[10000];
//to allow only jpg gif and png files to be uploaded.
string extension = Path.GetExtension(uplImage.PostedFile.FileName.ToUpper());
if (((extension == ".JPG") || ((extension == ".GIF") || (extension == ".PNG"))))
{
DALBio bio = new DALBio();
FileStream fs = new FileStream(uplImage.PostedFile.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
fs.Read(raw, 0, System.Convert.ToInt32(fs.Length));
bio.PlayerID = Session["playerID"].ToString();
bio.Pending = 'Y';
bio.Photo = raw;
DALBio.insertImage(bio);
}
}
When I try this, the stream is not reading the image. raw
never gets the image. It stays empty and it gets caught when it executes the stored procedure, saying I never passed the image. I am confident that code is just fine. I do not know why I can't get the image into my byte array.