Search code examples
phpapicloudpcloud

pCloud Your download expired. Try previous step again


i use pcloud infrastructure for users' uploading files on our website.

however i am having problems with the api. In the download function in file.php

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

we are using.but after a while to users say "Your download expired. Try previous step again." Gives a fault. I wonder if there is a way to solve this?I want unlimited download time.Thank you for your help

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


Solution

  • i found answer.

    you must add this code on download function, before return line;

            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);