上传文件后文件夹属性为什么会自动变为只读的??? 此例中 LogoImg 文件夹就会变为只读的
第二次就无法操作此文件夹中的文件了。 
请问是不是上传的代码有问题呀? 代码如下:    public bool UpLogoFile(string fileName, byte[] b)
    {
        try
        {
            string newFilePath = @"E:\LogoImg";            if (!Directory.Exists(newFilePath))
            {
                Directory.CreateDirectory(newFilePath);
            }            newFilePath = Path.Combine(newFilePath, fileName);
           
            MemoryStream m = new MemoryStream(b);
            FileStream f = new FileStream(newFilePath, FileMode.Create);            m.WriteTo(f);
            m.Close();
            f.Close();
            f = null;
            m = null;            return true;
        }
        catch
        {
            return false;
        }
    }

解决方案 »

  1.   

    string strPath = @"E:\xiaoshuo.txt";FileInfo fInfo = new FileInfo(strPath);复制代码通过上面途径建立文件信息后,就可以操作文件的下列属性:
    fInfo.IsReadOnly;fInfo.LastAccessTime;fInfo.LastAccessTimeUtc;fInfo.LastWriteTime;fInfo.LastWriteTimeUtc;fInfo.CreationTime;fInfo.CreationTimeUtc;fInfo.Attributes;
      

  2.   

    但是我没有用到FileInfo 呀。 我对文件这一块不熟。
      

  3.   

    服务器文件夹权限设置
    在属性->安全选项卡 里给个高级点的权限  比如加个everyone 完全控制的权限,当然这个不是十分安全。