各位高手,我要实现的功能是上传文件到文件夹,规定上传文件不能超过一定大小,然后文件夹也有容量大小限制,如果上传文件后文件夹大小超出时也进行提示。最好是能够实时显示文件夹的剩余空间,请问高手们怎么来实现这些。怎么设计,怎么编码。
谢谢啦^_^

解决方案 »

  1.   

    提示文件大小
    string getFileName=file.PostedFile.FileName.Substring(file.PostedFile.FileName.LastIndexOf("\\")+1);
    string getEx=getFileName.Substring(getFileName.LastIndexOf(".")+1);
    string[] getType=file.PostedFile.ContentType.Split('/');
    float nSize=file.PostedFile.ContentLength/1024;
    if(getEx.ToLower()!="rar"&&getType[1].ToLower()!="x-zip-compressed")
    {
    comm.WrongBack("您只能上传RAR格式或者ZIP格式的软件!");
    }
    if(nSize/1024>5)
    {
    comm.WrongBack("您上传的软件大小不能超过5MB!");
    }遍历一下文件夹的文件列表,将文件尺寸加起来,up.