Anyone that knows How to put image attachment to image control (to display)
if (FileUpload_Pic.PostedFile != null && FileUpload_Pic.HasFile)
{
Stream fStream = FileUpload_Pic.PostedFile.InputStream;
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
fStream.Dispose();
SPAttachmentCollection attachments = item.Attachments;
string fileName = Path.GetFileName(FileUpload_Pic.PostedFile.FileName);
attachments.Add(fileName, contents);
//listItem["Attached FileName"] = fileName; // store the name of the file in a column for future requirements
item.Update();
}
if (FileUpload_Doc.PostedFile != null && FileUpload_Doc.HasFile)
{
Stream fStream = FileUpload_Doc.PostedFile.InputStream;
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
fStream.Dispose();
SPAttachmentCollection attachments = item.Attachments;
string fileName = Path.GetFileName(FileUpload_Doc.PostedFile.FileName);
attachments.Add(fileName, contents);
}
// This is my code that i put in a list , but i would like to learn to put the same pictures in an Image Control Using Attachment that i upload to the list.