Jump to content

Show files uploaded to the server in a listBox


mmurgas

Recommended Posts

Hi all, I'm trying to show all files uploaded to the server in a directory XXXX ,
 
example:  Folder123 / *. *  ->
 
Folder123/ file1.jpg

Folder123/ file2.jpg

Folder123/ file3.jpg

 

 

UniServerModule.StartPath+'Folder123\'; ??????

 

 

Did anyone will have made?.
 
In advance, Thanks
 
mmurgas

 

Link to comment
Share on other sites

function FindFiles(searchstr: string; list: TStrings): boolean;
var
  hn: THandle;
  fd: WIN32_FIND_DATA;
begin
  Result := False;
  hn := FindFirstFile(PChar(searchstr),fd);
  if hn <> INVALID_HANDLE_VALUE then begin
    Result := True;
    list.Add(StrPas(fd.cFileName));
    while FindNextFile(hn,fd) = True do
      list.Add(StrPas(fd.cFileName));
  end;
  Windows.FindClose(hn);
end;

 

 

How to use:

 

ComboBox.Items.Clear;

FindFiles(folder+'*.jpg',ComboBox.Items);

 

 

 

You can use any windows wildcards like:

 

'pr_uc_??????_.adt'

 

 

 

Bruno

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...