امروز،
<?php
function download_remote($url, $save_path) {
set_time_limit (0);
$f = fopen($save_path, 'w+');
$handle = fopen($url, "rb");
while (!feof($handle)) {
$contents = fread($handle, 8192);
fwrite($f, $contents);
}
fclose($handle);
fclose($f);
}
if (isset($_POST['submit'])) {
$url = $_POST['url'];
$file_name = basename($url);
$save_path = $file_name;
download_remote($url, $save_path);
}
?>
<form action="" method="post">
<label>file address:</label><input type="text" name="url"/>
<p>example: http://********/1.zip</p>
<input type="submit" name="submit" value="Download"/>
</form>
این کد کامل تره
function download_remote($url, $save_path) {
set_time_limit (0);
$f = fopen($save_path, 'w+');
$handle = fopen($url, "rb");
while (!feof($handle)) {
$contents = fread($handle, 8192);
fwrite($f, $contents);
}
fclose($handle);
fclose($f);
}
if (isset($_POST['submit'])) {
$url = $_POST['url'];
$file_name = basename($url);
$save_path = $file_name;
download_remote($url, $save_path);
}
?>
<form action="" method="post">
<label>file address:</label><input type="text" name="url"/>
<p>example: http://********/1.zip</p>
<input type="submit" name="submit" value="Download"/>
</form>
این کد کامل تره