想要从服务器下载图像

发布于 2024-11-07 13:54:40 字数 109 浏览 0 评论 0原文

我想将站点从共享托管服务器转移到专用服务器。当前服务器有文件夹,其中包括大约。 16000 张图片...我们无法使用 FTP 下载这么多图片。而且我没有 SSH 权限?我如何从这个共享托管服务器下载图像。

I want to transfer site from shared hosting server to dedicated server.current server has folder,which includes approx. 16000 images...we can not use FTP to download these much images.and i do not have SSH rights? how can i download images from this shared hosting server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

断肠人 2024-11-14 13:54:40

我们无法使用FTP下载这么多图像

废话。 FTP(协议)完全能够下载 16000 个文件。如果您的 FTP 程序给您带来麻烦,只需选择一个更好的 FTP 程序即可。如果您可以处理命令行应用程序,wget 就很好,因为它支持递归和延续。

we can not use FTP to download these much images

Nonsense. FTP (the protocol) is perfectly capable of downloading 16000 files. If your FTP program is causing you trouble, simply pick a better FTP program. If you can handle commandline applications, wget is nice, since it supports recursion and continuation.

离线来电— 2024-11-14 13:54:40

除非它们位于 Web 应用程序服务器的 Web 根目录中,否则您就不走运了。

Unless they are located within a directory that is within the web root of a web application server you are out of luck.

纸伞微斜 2024-11-14 13:54:40

将它们全部压缩,改编自 http://davidwalsh.name/create-zip-php

    <?php

        function create_zip($files = array(),$destination = '',$overwrite = false) {
          //if the zip file already exists and overwrite is false, return false
          if(file_exists($destination) && !$overwrite) { return false; }
          //vars
          $valid_files = array();
          //if files were passed in...
          if(is_array($files)) {
            //cycle through each file
            foreach($files as $file) {
              //make sure the file exists
              if(file_exists($file)) {
                $valid_files[] = $file;
              }
            }
          }
          //if we have good files...
          if(count($valid_files)) {
            //create the archive
            $zip = new ZipArchive();
            if($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
              return false;
            }
            //add the files
            foreach($valid_files as $file) {
              $zip->addFile($file,$file);
            }
            //debug
            //echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;

            //close the zip -- done!
            $zip->close();

            //check to make sure the file exists
            return file_exists($destination);
          }
          else
          {
            return false;
          }
        }


    //glob images folder into an array
    foreach (glob("*.jpg") as $filename) {
        $files_to_zip[]='images/'.$filename;
    }
    //create the zip
    $result = create_zip($files_to_zip,'my-images.zip');
    if($result==true){echo'<a href="my-images.zip">Download Images</a>';
}else{
echo'Could not create zip';}

    ?>

Zip them all, adapted from http://davidwalsh.name/create-zip-php

    <?php

        function create_zip($files = array(),$destination = '',$overwrite = false) {
          //if the zip file already exists and overwrite is false, return false
          if(file_exists($destination) && !$overwrite) { return false; }
          //vars
          $valid_files = array();
          //if files were passed in...
          if(is_array($files)) {
            //cycle through each file
            foreach($files as $file) {
              //make sure the file exists
              if(file_exists($file)) {
                $valid_files[] = $file;
              }
            }
          }
          //if we have good files...
          if(count($valid_files)) {
            //create the archive
            $zip = new ZipArchive();
            if($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
              return false;
            }
            //add the files
            foreach($valid_files as $file) {
              $zip->addFile($file,$file);
            }
            //debug
            //echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;

            //close the zip -- done!
            $zip->close();

            //check to make sure the file exists
            return file_exists($destination);
          }
          else
          {
            return false;
          }
        }


    //glob images folder into an array
    foreach (glob("*.jpg") as $filename) {
        $files_to_zip[]='images/'.$filename;
    }
    //create the zip
    $result = create_zip($files_to_zip,'my-images.zip');
    if($result==true){echo'<a href="my-images.zip">Download Images</a>';
}else{
echo'Could not create zip';}

    ?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文