|
Posted by Manuel Lemos on 03/20/06 00:06
Hello,
on 03/18/2006 09:56 PM Bint said the following:
> I have even encoded my data in base64 so that it is ready to send as ASCII.
> This data is broken into chunks where after each 76 characters there is a
> \r\n line break. I read that I needed to do that.
No, that is not the way to post binary files.
> But HOW do I send it? If I send it as form data, with variables, then it
> only receives the data up until the first line break. I tried changing the
> content type to "Content-Type: application/octet-stream\n", thinking that I
> could just send the data without form variables, but then how do you access
> that from PHP? For example I tried sending the string "data=XXXYYY" where
> XXXYYY is my base64 encoded data, but it didn't work.
>
> I can't seem to find any good documentation about this. Which Content-Type
> shouldI be using? Can I use octet-streams and still have the data connected
> to php variables? It's very confusing.
You need to post it like normal forms with file fields. It must be sent
with multipart/form-data content type and then you need to compose a
multipart form body.
You may also want to take a look at this http client class that can post
files this way transparently:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Navigation:
[Reply to this message]
|