Hey Iván,
Thank you for the suggest; I'll go dig through there. However, my
question isn't really how do I get all the data that PHP received.
I wrote a PERL script to handle the file uploads. My multipart/form-
data form actually posts to that script aka (action=./upload.cgi).
This PERL script saves the actual RAW form data coming in to a file.
Then, on the users WWW page there is an AJAX "check status" call every
"x" ms. This call checks the file size of that raw file and compares
it to the expected size (which the PERL script also saves in a
"metric" file). One the file is completely uploaded; the PHP script
tries to save the data to a database table. The data in the file that
PERL saves is like so:
-----------------------------24464570528145
Content-Disposition: form-data; name="assessmen t_id"
13
-----------------------------24464570528145
Content-Disposition: form-data; name="attachmen t_type_id"
1
-----------------------------24464570528145
Content-Disposition: form-data; name="assessmen t_attachment";
filename="SomeT estFile.txt"
Content-Type: text/plain
test data here
-----------------------------24464570528145
Content-Disposition: form-data; name="note"
test
-----------------------------24464570528145--
You can see it's just standard boundary multipart data. So now that
file is is comlplete; a PHP script gets kicked off to read this "raw"
data and store sore the "data part" of it to the database. So; in PHP
I need to be able to parse this data. I can write a parser I guess
it's just boundary delineated with \r\n etc etc; but I thought PHP
might have a standard way I should be doing this.
Jeremy
On Jun 13, 7:58*pm, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.orgwrote:
jeremy.gehr...@ gmail.com wrote:
[...]
I know that when you make a post to PHP; it's little request wrapper
parses this for you into the $_FILES array. *How can I read a file
(the raw form data) and feed it to that parser?
If you know how the CGI model was designed, you know that the process
serving the request gets all the POST data via standard input
(AKA "stdin").
So, your question becomes "How do I get all the data that PHP received
through standard input, without the parser that sets up $_FILES and so gets
in the way?"
The answer resides in one of the last chapters of the PHP manual. Go there,
search for fopen() wrappers, search on how to get to stdin, stdout and
stderr. If you actually have worked with low-level CGI handling, it should
pose no match for you.
Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
"kill -9 needs no justification!"
* * * * * * * * * * * * * * * *-- BOFH