binary POST data
| From: | C C | Date: | Fri, 23 Jan 2004 15:19:44 +0000 |
| Subject: | binary POST data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-175518@lists.php.net to get a copy of this message | ||
Hello,
I am trying to process POST data sent from a device. Here is a capture of what is being sent from
the device (with the file data replaced by <File Contents>):
POST file.php HTTP/1.1
Host: ---.---.---.---
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=--------------------BC368B1E
Content-Length: 4841
----------------------BC368B1E
Content-Disposition: form-data; name="ID"
50
----------------------BC368B1E
Content-Disposition: form-data; name="FName"
File.doc
----------------------BC368B1E
Content-Disposition: form-data; name="FileLength"
4096
----------------------BC368B1E
Content-Disposition: form-data; name="FileData"
<File Contents>
--------------------BC368B1E--
The FileData contains the contents of a file being sent to the script. It works for sending text
files, but when sending binary files, it stops at the first null byte. I tried parsing it using
php://input and $HTTP_RAW_POST_DATA (always_populate_raw_post_data is On in php.ini), but neither of
these are set. Is it possible to get the contents of binary files POSTed this way in PHP? I
can't change how the data is sent from the device. Our ASP page is able to do this with the
same POST.
Also, inserting binary data using odbc into a MS SQL Server database fails if the data has null
bytes. We are using Apache + PHP on Windows.
Thanks,
CC
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!