Do I actually need to save the file first? Or can I do something like 
this...

/* File type and other checks here */

$name = preg_replace("/[^A-Z0-9._-]/i", "_", $_FILES["fileupload"]["name"]);
$hex   = bin2hex($name);

Cheers


On Tuesday, November 27, 2012 10:01:28 AM UTC+13, David Neilsen wrote:
>
> bin2hex(file_get_contents($image));
>
> David Neilsen | 07 834 3366 | PANmedia ®
>
>
> On Tue, Nov 27, 2012 at 10:00 AM, Jay <[email protected] <javascript:>>wrote:
>
>> // read file
>> $fp = fopen($filename,"rb", 0);
>> $gambar = fread($fp,filesize($filename)); 
>> fclose($fp);
>> // base64 encode 
>> $base64 = base64_encode($gambar);
>>  
>>
>>
>>
>> On Tue, Nov 27, 2012 at 9:57 AM, rusdvl <[email protected]<javascript:>
>> > wrote:
>>
>>> URL encoded.
>>>
>>>
>>> On Tuesday, November 27, 2012 9:56:13 AM UTC+13, Brett Taylor wrote:
>>>
>>>> Are they just asking for the file to be MIME or URL encoded or 
>>>> something when you send it to them? I'd ask them for clarifications on 
>>>> what 
>>>> they are actually requesting.
>>>>
>>>> Brett
>>>>
>>>> On 27/11/2012, at 9:50 AM, rusdvl <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am currently building a form that is meant to send the contents via 
>>>> an API to a flex based program. The developers on the other side are 
>>>> asking 
>>>> the uploaded images to be a hexadecimal string of the image binary... 
>>>> I have been googling for a few hours, but obviously my google-fu is weak 
>>>> as 
>>>> I am unable to find any sample code or any tutorials/examples on how to do 
>>>> so.
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> Cheers!
>>>>
>>>> -- 
>>>> NZ PHP Users Group: 
>>>> http://groups.google.com/**group/nzphpug<http://groups.google.com/group/nzphpug>
>>>> To post, send email to [email protected]
>>>>
>>>> To unsubscribe, send email to
>>>> nzphpug+u...@**googlegroups.com
>>>>
>>>>
>>>>  -- 
>>> NZ PHP Users Group: http://groups.google.com/group/nzphpug
>>> To post, send email to [email protected] <javascript:>
>>> To unsubscribe, send email to
>>> [email protected] <javascript:>
>>>
>>
>>  -- 
>> NZ PHP Users Group: http://groups.google.com/group/nzphpug
>> To post, send email to [email protected] <javascript:>
>> To unsubscribe, send email to
>> [email protected] <javascript:>
>>
>
>

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to