note 69970 deleted from function.copy by nlopess
| From: | nlopess@php.net | Date: | Thu, 28 Sep 2006 13:42:54 +0000 |
| Subject: | note 69970 deleted from function.copy by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117773@lists.php.net to get a copy of this message | ||
Note Submitter: Sulo
----
Hi all. I'm from Slovakia. I've made this script for downloading files from remote server
to the local server:
<?php
/* PASSWORD */
$good_passw = "your_passw";
/* LOCAL DIRECTORY */
$dir = "../dwnl/";
if (isset($_REQUEST['remote_file']) && isset($_REQUEST['passw'])) {
if (strpos($_REQUEST['remote_file'],"://") === false)
die("Bad file!");
if ($_REQUEST['passw'] != $good_passw)
die("Bad password!");
copy($_REQUEST['remote_file'], $dir.basename($_REQUEST['remote_file']));
die("OK.");
}
?>
<form name="dwnl" action="d.php" method="post"
target="_blank">
<input type="text" name="remote_file"/>
<input type="password" name="passw"/>
<input type="submit" value="[OK]"/>
</form>
PHP doesn't check max. script execution time while executing the copy() function. So you can
use it at any server, even if you don't have permission to change max. script execution time.
Closing the browser window doesn't cause script execution end. But there's also some
problem. When copying big files (e.g. 2.5 GB), this script ends and prints 'OK', even if
only 9MB of file were copied.