ID:2377542
 
(See the best response by Nadrew.)
Code:


Problem description:

Essentially, I have player logs from in game, and they currently save as directed in the code

Data/Players/(player key)

Now, this folder is created inside the host folder. What I am trying to do is to see if it is possible to save these log files outside of the host folder, and essentially, say the directory path that I want it to save.

My game is hosted through ByondPanel, and I'd like the log files to save into the www folder.

Thanks for your time.

Best response
Only if you have the ability to run the game in trusted mode. In safe and ultrasafe mode you don't have access to anything outside of the game's directory.

I don't believe ByondPanel would allow that.

However, this isn't true for things like Python/PHP/whatever, you could use a script to copy the files from the game directory to the www directory.

The game obviously wouldn't be able to access them in the www directory though.
Doing it via PHP is completely possible, I believe OP already contacted us and I've given that solution.

http://php.net/manual/en/function.file-get-contents.php
I've tried the file-get-contents route, and it doesn't seem to work.

I have a file explorer javascript that I am using to view player logs easily and efficiently. Currently, I am copy and pasting logs into a folder inside the webroot for it to work, but I am trying to streamline the process and cut out the added step.

Currently, in my php, I have $dir = 'Logs';

I've tried editing this to $dir = file_get_contents('../'); and it doesn't find any files
You'd want scandir() to list the contents of a directory, file_get_contents() does exactly what the name says, loads the information within a file.