public static byte[] GetPhoto(string filepath)
{
FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(stream);
byte[] photo = reader.ReadBytes((int)stream.Length);
reader.Close();
stream.Close();
return photo;
}
{
FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(stream);
byte[] photo = reader.ReadBytes((int)stream.Length);
reader.Close();
stream.Close();
return photo;
}
파일 경로를 인자로 넘겨서 파일스트림으로 생성하고 파일을 바이너리리더로 바이트배열에 2진데이터로 넣는다.
[DB에 파일을 넣을때 사용했다]
'Sunmoon_BIT > .NET' 카테고리의 다른 글
Microsoft Report View <마이크로소프트 레포트 뷰어> (1) | 2010.04.19 |
---|---|
Validation Control <유효성 검사 컨트롤> (0) | 2010.04.19 |
선비 버젼3.0 [Sunbee] (0) | 2010.04.16 |
Remoting (0) | 2010.04.06 |