found this function on the web
function FileDeleteRB(AFileName: string): boolean;
var Struct: TSHFileOpStruct;
    pFromc: array[0..255] of char;
    Resultval: integer;
begin
   if not FileExists(AFileName) then begin
      Result := False;
      exit;
   end
   else begin
      fillchar(pfromc,sizeof(pfromc),0) ;
      StrPcopy(pfromc,expandfilename(AFileName)+#0#0) ;
      Struct.wnd := 0;
      Struct.wFunc := FO_DELETE;
      Struct.pFrom := pFromC;
      Struct.pTo := nil;
      Struct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION
         or FOF_SILENT;
      Struct.fAnyOperationsAborted := false;
      Struct.hNameMappings := nil;
      Resultval := ShFileOperation(Struct) ;
      Result := (Resultval = 0) ;
   end;
end;   //FileDeleteRB
I have put it into utilib.pas and call it from the deletion() procedure in main.pas
    procedure deletion();
    var
      i: integer;
      s: string;
    begin
    if (conn.request.method <> HM_POST)
    or (data.postVars.values['action'] <> 'delete')
    or not accountAllowed(FA_DELETE, conn, f) then exit;
    for i:=0 to data.postvars.count-1 do
      if sameText('selection', data.postvars.names) then
        begin
        s:=decodeURL(data.postvars.valueFromIndex);
        if ansiEndsStr('/', s) then setLength(s, length(s)-1); // folders' url
        if anycharIn('\/', s) then continue;
        s:=f.resource+'\'+s;
        if not FileDeleteRB(s) then
        if not moveToBin(s) then
        end;
    end; // deletion
When by mistake, a file destroyed from the web page does not disappear irreparably, but is moved in the recycle bin of Windows, and in case the recycle bin is full, then the file is definitively lost for everybody 
 
 