PHP使用url将大文件下载到服务器

时间:2017-01-13 09:16:22

标签: php url download server

我必须下载大尺寸文件> xxx MB / GB使用PHP代码。我该如何下载? 我写了这段代码,但我无法下载最大的< 45 mb。但我需要下载lass然后1 GB ..

<?php
##Simple download file for URL's##

if(isset($_POST['download'],$_POST['downloadurl'])) {
    $downloadurl = htmlspecialchars($_POST['downloadurl']);
    if(!empty($downloadurl)) {
        if (@fopen($downloadurl, "r")) {
            $file = basename($downloadurl);
            if(copy($downloadurl, $file)) {
                echo "Fayl serverga ko'chirildi! <br />";
                echo '<textarea>'.$_SERVER['HTTP_HOST'].'/'.$file.'</textarea>';
            } else {
                echo "We're sorry we can't download this file!";    
            }
        } else {
            echo "This url is empty or not file!";
        }   
    } else {
        echo "Please enter url filei!"; 
    }

    exit(); 
}


echo '<form action="download.php" method="post">
    URL FILE: <br /><input type="text" name="downloadurl" ><br />
    <input type="submit" name="download" value="submit">';

0 个答案:

没有答案