怎么实现上传文件呢?比如说压缩文件。
还有我想实现在用户上传文件后修改它的名字,使文件名递增,该怎么做呢?

解决方案 »

  1.   

    string filename="ccc";//在这可以修改它的名字
    string CurrentPath=Server.MapPath("a");
    string fullpath=CurrentPath+@"\"+filename;
    aaa.PostedFile.SaveAs(fullpath);
    Response.Write(fullpath);
    <input type="file" id=aaa
    其中aaa为上传控件的id
      

  2.   

    楼上正解,然后在命名规则加入System.DateTime.Now.Year.ToString()+System.DateTime.Now.Month.ToString()+;解决……
      

  3.   

    string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss");//以上传的日期时间命名
    string serverPath = Server.MapPath("upFiles");//upFiles 为你要上传的目录
    string fullName = serverPath + @"\"+ newFileName;
    file1.PostedFile.SaveAs(fullName);