You are here: Re: How would I write MIME data back to a file? « PHP Language « IT news, forums, messages
Re: How would I write MIME data back to a file?

Posted by Shawn Wilson on 11/21/11 11:33

"Steve" <googlespam@nastysoft.com> wrote in message
news:1133351836.468083.149130@g49g2000cwa.googlegroups.com...
>
>
>> ------=_NextPart_000_002E_01C5F533.57C1E7F0
>> Content-Type: application/octet-stream;
>> name="avatar.jpg"
>> Content-Transfer-Encoding: base64
>> Content-Disposition: attachment;
>> filename="avatar.jpg"
>>
>> /9j/4AAQSkZJRYq7FXYq7FX/2Q==
>>
>> ------=_NextPart_000_002E_01C5F533.57C1E7F0--
>
>> If I have that stored in $attachment01, then what command would write it
>> back to a file named avatar.jpg and be a picture again?
>
> <http://www.php.net/base64_decode>
>
> $img = base64_decode( $attachment01 );
> $fp = fopen( 'avatar.jpg', 'wb' );
> fwrite( $fp, $img );
> fclose( $fp );
>
> ---
> Steve
>

Thank you very much, I knew it had to be pretty easy once I got the right
function name...

--
Shawn Wilson

 

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

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