首页 > 解决方案 > pCloud 您的下载已过期。再次尝试上一步

问题描述

我使用 pcloud 基础架构让用户在我们的网站上上传文件。

但是我在使用 api 时遇到了问题。在file.php中的下载函数中

$ fileLink = $ this-> getLink ($ fileId); 

我们正在使用。但过了一会儿,用户说“您的下载已过期。再试一次上一步。” 给出一个错误。我想知道有没有办法解决这个问题?我想要无限下载时间。谢谢你的帮助

API Github:http: //github.com/pCloud/pcloud-sdk-php/

标签: phpapicloudpcloud

解决方案


我找到了答案。

您必须在返回行之前在下载功能上添加此代码;

        header('Content-Description: Description');
        header('Content-Type: application/x-zip-compressed');
        header('Content-Disposition: attachment; filename='.basename($path));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($path));
        fclose($file);
        fclose($source);
        readfile($path);

推荐阅读