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();
        }


 

你可能感兴趣的:(server)