Copy file from host to other folder on host - Forum

Forum Navigation
You need to log in to create posts and topics.

Copy file from host to other folder on host

Hi. I have a file for example:

Public HTML/x.txt

And I want when user click on button, this file copy to:

Public HTML/folder/y.txt

@tilesoft have you tried neoPhpFileCopy command?

Regards.

tilesoft and javadrajabihakami have reacted to this post.
tilesoftjavadrajabihakami

Yes but I don't know how it works.

 

Thank you

@tilesoft have you already seen this video?

https://www.youtube.com/watch?v=LbxM2KfT0YA

It has basic information about how to use neoPhp plugin and Server.

Regards.

And my last question is, how can I create a folder with variable name on host?

And my last question is, how can I create a folder with variable name on host?

I have not included that option in neoPhp for security reasons. If you can create a folder directly from your script then anyone can.
I added permissions retrictions for reading and writing files to avoid  security issues but regarding folders that's not as easy.
You can use file name subfixes or prefixes instead or call a custom .php script to create the folder. For example save this code as createfolder.php file:

<?php
$thePath = $_POST['thePath'];
if (!file_exists($thePath)) {
    mkdir($thePath, 0777, true);
}
?>

Then you can call this PHP script from VisualNEO Web:

CreateEmptyObject [mydata]
SetVar [mydata.thePath] "path/to/directory"
neoAjaxSend "createfolder.php" "POST" "[mydata]" "json" "" ""

But, without user permission controls, this will allow anyone to create any folder on the server.

Regards.