Re: Storing binary data within a php script.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Jed,

Im just trying your method.

If i have any problems ill reply to this post

Jamie

"Jed Smith" <jed@xxxxxx> wrote in message 
news:20041219032707.14888.qmail@xxxxxxxxxxxxxxx
> This is done in a few examples using base64_encode() and base64_decode(). 
> A particular OpenGL example I can recall encoded a small (~20k) DLL 
> directly into the PHP source that relied upon it, then unpacked it at 
> runtime.
>
> Ah, there it is:
>
>    ** snip **
>
>   if ( is_file( "SimpleWndProc.dll" ) ? filesize( "SimpleWndProc.dll" ) != 
> 2560 : 1 )
>   {
>      $dll = 
> "eNrtVU9IFGEUf7NpTbZue1hCYqlvQT3JslsG0clt/aho1XHNDOnguDutY+uMzh80"
>           . 
> "KDrYQTPJS1TUoWMEdSpYrEOEsQl66yD9gT1ILCHhIcqDML35Zla3IgO7mQ9+733v"
>   /* ... */
>           . 
> "dxBP8K4dRTzGcY6dBwcd8sBgVupS0lgfi9siXnQPAErZOyqrYXMXwO/8l7oiy5Fv"
>           . "kdWIJ8pHfdFAdH90uzf+D/QDFVAQCA==";
>
>     $dllout = fopen( "SimpleWndProc.dll", "wb" );
>
>     if ( !$dllout )
>       die( "Unable to extract SimpleWndProc.dll" );
>
>     fwrite( $dllout, gzuncompress( base64_decode( $dll ) ) );
>     fclose( $dllout );
>
>   ---------------
>
> That's from an iridium example. You just base64 encode the data and 
> enclose it in a string. Of course, that's simply one way of doing it.
>
> Jed
>
> Jamie wrote:
>> Hi all,
>>
>> Well so far my attempts to make this work have failed so i thought i 
>> would try here. What i have is an installation script that has to write a 
>> few files to the webserver. Im trying to cut down on the amount of files 
>> that need to be uploaded/modified etc. So what im trying to do is include 
>> all the data in one file. What the user then uploads and the physical 
>> visual basic program activates the script what in turn sets up the web 
>> server side. The problem comes when im trying to handle the ascii values 
>> for the binary data. "Warning: Unexpected character in input: '' 
>> (ASCII=3) state=2."
>>
>> I basicly have 3 questions.
>>
>> 1) Is it possible to store binary data in text form during transport and 
>> then using php's file writing functions to output the file?
>> 2) How would i do it as i guess i have to encode the ascii characters but 
>> how would i do that?
>> 3)Is there any better ways you suggest me to do this.
>>
>> Im trying to this for two reasons first is to make the application usable 
>> by anyone and the second reason is to try to push the boundarys of the 
>> langage.
>>
>> I would like anyones comments and views on this please. Any views might 
>> help me come to a result.
>>
>> Thanks
>>
>> Jamie
>
>
> -- 
>      _
>     (_)___    Jed Smith, Code Monkey
>     | / __|   jed@xxxxxx | jed@xxxxxxx
>     | \__ \   +1 541 606-4145
>    _/ |___/   Signed mail preferred (PGP 0x703F9124)
>   |__/        http://personal.jed.bz/keys/jedsmith.asc 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux