T
TrueFail
Unregistered / Unconfirmed
GUEST, unregistred user!
我用DELPHI做了一个包括文件上传,目录管理的Automation对象。
功能也已实现,但在ASP中使用了该对象以后所有被它操作到的目录(只是读取该目录下有什么文件)
,文件都不能被删除了,
用其他的程序也不能打开该目录下的文件了。操作系统是WIN2000高级服务器版+IIS 5。
该如何解决该问题????????????????
(打开文件函数)
function TFileManage.ReadFile(AFileName: OleVariant): OleVariant;
var
TmpList:TStringList;
begin
TmpList:=TStringList.Create;
try
try
TmpList.LoadFromFile(AFileName);
Result:=TmpList.Text;
except
Result:='';
end;
finally
TmpList.Free;
end;
end;
(删除目录及文件函数)
function TFileManage.DelFolder(AFolder: OleVariant): OleVariant;
var
Found:integer;
SearchResult:TSearchRec;
begin
FileSetAttr(AFolder,0);
if FileGetAttr(AFolder)<>faDirectory then
begin
DeleteFile(AFolder);
exit;
end;
Found:=FindFirst(AFolder+'/*.*',faAnyFile,SearchResult);
while Found=0 do
begin
if (SearchResult.Name<>'.')and(SearchResult.Name<>'..') then
DelFolder(AFolder+'/'+SearchResult.Name);
Found:=FindNext(SearchResult);
end;
if (SearchResult.Name<>'.')and(SearchResult.Name<>'..') then
FindClose(SearchResult);
RmDir(AFolder);
end;
功能也已实现,但在ASP中使用了该对象以后所有被它操作到的目录(只是读取该目录下有什么文件)
,文件都不能被删除了,
用其他的程序也不能打开该目录下的文件了。操作系统是WIN2000高级服务器版+IIS 5。
该如何解决该问题????????????????
(打开文件函数)
function TFileManage.ReadFile(AFileName: OleVariant): OleVariant;
var
TmpList:TStringList;
begin
TmpList:=TStringList.Create;
try
try
TmpList.LoadFromFile(AFileName);
Result:=TmpList.Text;
except
Result:='';
end;
finally
TmpList.Free;
end;
end;
(删除目录及文件函数)
function TFileManage.DelFolder(AFolder: OleVariant): OleVariant;
var
Found:integer;
SearchResult:TSearchRec;
begin
FileSetAttr(AFolder,0);
if FileGetAttr(AFolder)<>faDirectory then
begin
DeleteFile(AFolder);
exit;
end;
Found:=FindFirst(AFolder+'/*.*',faAnyFile,SearchResult);
while Found=0 do
begin
if (SearchResult.Name<>'.')and(SearchResult.Name<>'..') then
DelFolder(AFolder+'/'+SearchResult.Name);
Found:=FindNext(SearchResult);
end;
if (SearchResult.Name<>'.')and(SearchResult.Name<>'..') then
FindClose(SearchResult);
RmDir(AFolder);
end;