Trying to write a file to a different directory using fopen()
I'm trying to write a file from one directory to another. For example, http://www.xxxxxxx.com/admin/upload.php to http://www.xxxxxxx.com/posts/filename.php I've read that I cannot write a file by using the HTTP path, how do I use a local path? $ourFileName = "http://www.xxxxxxxx.com/articles/".$thefile.".php"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); You should use the absolute or relative path to the file on the file system. <?php $absolute_path = '/full/path/to/filename.php'; $relative_path = '../posts/filename.php'; // use one of $absolute_path or $relative_path