Hello,
Yes, what you're trying to do is possible, but there are a few important details to keep in mind, especially regarding file access permissions and path handling in a UniGUI environment.
Since your application runs as a DLL under the web server, file system access is subject to the user permissions of the web server's process.
Make sure that the account under which your web server or UniGUI DLL runs (e.g., IUSR, NETWORK SERVICE, or your custom app pool identity in IIS) has read access to C:\musicas\ and write access to C:\my app\files\.
uses
System.IOUtils, Winapi.Windows;
procedure CopyMp3File;
var
SourceFile, DestFile: string;
begin
SourceFile := 'C:\musicas\my.mp3';
DestFile := UniServerModule.FilesFolderPath + 'my.mp3';
if TFile.Exists(SourceFile) then
begin
if CopyFile(PChar(SourceFile), PChar(DestFile), False) then
ShowMessage('File copied successfully!')
else
ShowMessage('Failed to copy the file.');
end
else
ShowMessage('Source file not found.');
end;