You are here: Re: email attachment from file result « PHP « IT news, forums, messages
Re: email attachment from file result

Posted by Bernhard Kraft on 02/07/05 15:15

chris phillips wrote:

First of all:

> $file = file("download.php");
> $data = fread($file, filesize("download.php"));
> $data = chunk_split(base64_encode($data));

That won't ever work.

file(...) reads in the complete content of an file.
to open a file for reading with "fread" use "fopen"

The following code can retrieve the contents of the download.php script
if you have fURL wrappers enabled (safe mode disabled):
--------------snip--------------------
$fd = fopen("http://mysite.com/download.php", "rb");
while (!feof($fd)) {
$new = fread($fd, 100000);
$data .= $new;
if (!strlen($new)) break;
}
fclose($fd);
$data = chunk_split(base64_encode($data));
--------------snip--------------------


greets,
Bernhard

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация