Save a file to the same directory with the program

I try to create az auto update consol application. This app download and save program executables to the same directory with the updater program. I use Data folder for config file. When my app download the executables, this files are always stored in the data directory not in the program directory. The update program location is: c:\program\update.exe. Data folder is: c:\program\data. The replaced file location is: c:\program\app.exe.
I use copy for downloading: $copy = copy($remote_file_url, $local_file_name); How can I solve this problem?
Thank you your help

Try to change your path with \..\ to target the parent dir.