Reputation: 15
I have to start a download with php of a file inside a password protected folder.
I have the following code:
<?php
$File="https://testuser:[email protected]/test/2/file.zip";
if(file_exists($File))
{
header("Content-Disposition: attachment; filename=\"" . basename($File) . "\"");
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($File));
header("Connection: close");
readfile($File);
}
?>
file_exists and filesize seems that don't work with this kind of url. How can I solve the problem?
Upvotes: 0
Views: 116