upload file to server

Way 1:
      UpLoadFile webcontrol can finish it easy
FileUpLoad ful_load =new FileUpLoad(); //FileUpLoad is a kind of control
…..
Set the upload file name;
ful_load.SaveAs(Server.MapPath(ful_load.FileName));
that’s ok!

Way 2:   can upload many files in one time

        if (Request.Files.Count < 1)
            return;
        HttpPostedFile file = Request.Files[0];
        if (file != null && file.FileName.Length > 0)
        {
            file.SaveAs(Path.Combine(GetCurDir(), Path.GetFileName(file.FileName)));
            file.InputStream.Close();
        }


 

posted on 2008-01-04 21:34  飞天舞者  阅读(457)  评论(0编辑  收藏  举报

导航

For more information about me, feel free email to me winston.he@hotmail.com