R
R
Rodion Yurchenko2015-10-13 09:33:56
PHP
Rodion Yurchenko, 2015-10-13 09:33:56

How can I copy a file from one site to another using php?

Good afternoon!
There is a sitename.com site, which has an index.php file in the source folder
There is a site on a subdomain - abc.sitename.com - there are only a couple of files and folders
You need to use the php script that is in sitename.com
1) delete all files and folders from abc.sitename.com
2) copy index.php from sitename.com/source to abc.sitename.com
read everything you need to work with files - delete / copy, etc. - I can, but within 1 site...
but how to get to the file structure of the site on a subdomain - I'll never know ....

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Magzhan Birgebayuly, 2015-10-13
@aassdds

The site is on the same server. For example - if you run from the file sitename.com/test.php :

copy( './source/index.php', '../abc.sitename.com/index.php' );

A
Alexey Skobkin, 2015-10-13
@skobkin

If there is no direct access through the FS, you can, for example, connect via FTP to one or both sites.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question