protected void btnClick_Click(object sender, EventArgs e)
{
if (Page.IsValid) //validator를 통과 했다면
{
string dir = @"c:\Files1\"; //c밑에 만들어 놓고
string iFullName = this.FileUpload1.PostedFile.FileName;
string oFullName = dir+this.FileUpload1.FileName;
FileStream fi = new FileStream(iFullName, FileMode.Open);
FileStream fo = new FileStream(oFullName, FileMode.Create);
int i = 0;
do
{
i = fi.ReadByte();
if (i != -1)
fo.WriteByte((byte)i);
}
while (i != -1);
//읽어 들일 것이 없을때까지 읽어 들여라
fi.Close();
fo.Close();
this.lbl1.Text = "클라이언트의 원본파일" + iFullName + "</br>" +"서버에 복사된파일: "+oFullName;
}
}
댓글 영역