上传文件后文件夹属性为什么会自动变为只读的??? 此例中 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;
}
}
第二次就无法操作此文件夹中的文件了。
请问是不是上传的代码有问题呀? 代码如下: 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;
}
}
fInfo.IsReadOnly;fInfo.LastAccessTime;fInfo.LastAccessTimeUtc;fInfo.LastWriteTime;fInfo.LastWriteTimeUtc;fInfo.CreationTime;fInfo.CreationTimeUtc;fInfo.Attributes;
在属性->安全选项卡 里给个高级点的权限 比如加个everyone 完全控制的权限,当然这个不是十分安全。