I was making a script for remote upload files to my server and here the code. BTW i took it from a site. I didn't post the site name or it might b considered as spam or something. Its about downloading remote files into our server.
<?php
if (isset($_POST['myupload']))
{
$links_list = $_POST['upload'];
$incr = 0;
$links = explode("
",$links_list);
define('BUFSIZ', 4095);
for ( $incr == 0 ; $incr < count($links) ; $incr++ )
{
$url = $links[$incr];
$rfile = fopen($url, 'r');
$lfile = fopen(basename($url), 'wb');
while(!feof($rfile))
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
fclose($rfile);
fclose($lfile);
}
}
?>
<script type="text/javascript"></script>
</head>
<body>
<div id="upload_box">
<form action="" method="post">
<textarea name="upload" cols=80 rows=20></textarea>
<input type="submit" name="myupload" value="Upload Files">
</form>
I want to ask few things about this script.
$lfile = fopen(basename($url), 'wb')
< what does this code do ?fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
< and what about this code ?
I know am asking a foolish question but hope you guys could shed some light on that for me.