<asp:FileUpload ID="FileUploadPassfoto" runat="server"
Width="100%" Style="background-color: #533473; border-color: lightgray;" />
This is my FileUpload created with asp.net. Only images will be uploaded! In my C# Code Behind i tried this code:
HttpPostedFile file = FileUploadPassfoto.PostedFile;
using (BinaryReader binaryReader = new BinaryReader(file.InputStream))
{
lehrling.passfoto = Convert.ToBase64String(binaryReader.ReadBytes(file.ContentLength));
}
lehrling.passfoto is a string variable. When i debug through my code. the lehrling.passfoto has the value "". So an empty string. What am i doing wrong? The httppostedfile works just fine. The filepath and contentlenght are correct.... Any suggestions