Reply to Re: What does -> do?

Your name:

Reply:


Posted by Rik on 01/13/07 15:19

Manfred Kooistra wrote:
> Thank you, Rik.
> Alas, that wasn't it.
>
> I found out that the problem was trying to attach the file after
> fopening and freading it. On debug, I got an error message telling me:
> "File is not readable." I was wondering about that, because that files
> permissions and path are alright. So I simply attached it without
> fopening it - and that did the trick!
>
> Not working:
>
> $handle = fopen($uploaded_file_path, 'r');
> $file = fread($handle, filesize($uploaded_file_path));
> $mime->addAttachment($file, "image/$typ", $uploaded_file_name);
> fclose($handle);
>
> Working:
>
> $mime->addAttachment($uploaded_file_path, "image/$typ",
> $uploaded_file_name);
>
> (with $typ preg_match/substr-ed from the file name)
>
> I wonder about this, because I found hundreds of
> mail-attachment-examples with fopen/fread, but I'm happy that my
> script is running and I get mailed the uploaded files.

Well, it always pays to read up on the functions. Does it take the data of
a file, or the filename, that's the only difference.
--
Rik Wasmus

[Back to original 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

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