how specify a directory to file when downloading it
-
I use this code to download a file from remote server to mine and the file is created and saved but in the home directory and i want it in the plugin directory
$url ='*.dat'; // Use wp_remote_get to fetch the data $response = wp_remote_get($url); // Save the body part to a variable $fileContent = $response['body']; // Create the name of the file and the declare the directory and path $file ='*.dat'; // Now use the standard PHP file functions $fp = fopen($file, "w"); fwrite($fp, $fileContent); fclose($fp);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘how specify a directory to file when downloading it’ is closed to new replies.