By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,642 Members | 1,681 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,642 IT Pros & Developers. It's quick & easy.

Copy Files From Remote URL

P: n/a
Hi,

how can I copy a file from a url into the directory where my php file is located?

On the server I use it is not possible to use the copy() function for this task.

Thaks for your help!

boogalo
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

boogalo wrote:
Hi,

how can I copy a file from a url into the directory where my php file is located?


This could work, but allow-url-fopen has to be turned on.

<?php
$content = file_get_contents('URL');
$dir = dirname($_SERVER['SCRIPT_FILENAME']);
$fp = fopen($dir.'/filename', 'w');
fwrite($fp, $content);
fclose($fp);
?>

bye,
Alex
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.