Darlan Posted April 8, 2025 Posted April 8, 2025 Hello, I'm having the following problem to solve, if you can help me I'd be grateful: I need to play .mp3 files that are on the same server that is running my DLL in Unigui, when I put the file inside the files folder it plays fine, but I need to get this file from another folder outside the files folder in a previous directory, as I do via Unigui, to copy this file from a folder outside the default folder that has the DLL. My folder structure is as follows: c:\musicas\ (which has my .mp3 files) c:\my app\ (which has my DLL in Unigui) I need to copy a certain .mp3 file from the folder c:\musicas\my.mp3 to the folder c:\my app\files I can't do it, because from what I've noticed my application in Unigui only accepts copying from within the default folder where my application in Unigui is. Is there any way I could copy the .mp3 file from an external folder (but within the same server) to my application's files folder? Darlan Almeida. Quote
Hayri ASLAN Posted April 8, 2025 Posted April 8, 2025 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; 1 Quote
combro Posted April 10, 2025 Posted April 10, 2025 Hi, maybe you want to try another way without having to copy a file into the uniGUI application folder, namely by creating symbolic links on Windows OS, you can find out what symbolic links are. To create it, you can open Command Prompt with administrative privileges. mklink /D <destination> <source> mklink /D c:\myapp\mp3 c:\musicas\ 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.