Grega Leskovšek wrote:
> I tried to download the file from another server the fancy way in PHP, but
> it just display blank screen. Can You please look at my code:
>
> <?php
> $filepath = "http://aaaaaa.yolasite.com/resources/happytears.doc";
> // $filepath = "http://users.skavt.net/~gleskovs/else/happytears.doc";
> if (file_exists($filepath)) {
I see in the manual that file_exists can now check URLs, but my guess
would be that it needs to have the allow_url_fopen statement in the
php.ini set to "On".
See
> header("Content-Type: application/force-download");
> header("Content-Disposition:filename=\"happytears.doc\"");
> $fd = fopen($filepath,'rb');//I tried also just 'r' and am not clear on
> which documents should I add b for binary? As I understand only text plain
> files and html files and php etc files are without 'b'. All documents,
> presentations, mp3 files, video files should have also 'b' for binary along
> r. Am I wrong?
> fpassthru($fd);
> fclose($fd);
> }
> ?>
> Both filepaths are valid and accessible to the same document. I double
> checked them. Please help me. Thanks in advance, Yours, Grega
>
See what you get with this
<?php
$filepath = "http://aaaaaa.yolasite.com/resources/happytears.doc";
if (file_exists($filepath)) {
echo 'File found';
} else {
echo 'File NOT found';
}
?>
Jim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php