public void UploadImage(int listingId, string imagePath) { if (imagePath != null) { FileStream fs; BinaryReader br; string FileName = imagePath; byte[] ImageData; fs = new FileStream(FileName, FileMode.Open, FileAccess.Read); br = new BinaryReader(fs); ImageData = br.ReadBytes((int)fs.Length); br.Close(); fs.Close(); if (_uploadRepository.UploadImage(listingId, ImageData) == false) { MessageBox.Show("Could not upload image!", "Error"); } } else { MessageBox.Show("Could not load image!", "Error"); } }