I have a host that I have very little control that is sending an http post that contains images, and file information. I am able to view this information with the help of the getallheaders() function that contains the follwing array values: ("Basic cm9vdDpzYXZ5Y2F0X2Jvb3N0ZXI=", "attachment; filename=image02048.jpg", "12389", "image/jpeg", "shttpclient $Revision: 1.28 $", "a", "s"). I assume that the first value is the actual image, and the rest of the values are file parameters. My goal is to save the file to a specified directory. I have a good deal of experience uploading files via html form enctype='multipart/form-data' and writing these files to anywhere in the file system, but I have no experience with the getallheaders() function or what to do with the array except parse out the values. TIA - cmc
You do not need to read any headers for file uploads in PHP... Use the $_FILES array to get all the info you need about them: http://www.php.net/manual/en/reserved.variables.php#reserved.variables.files From that info, you can use PHP functions to move them, rename them or whatever else you need to do.
this http post is NOT coming from a html form with enctype="multipart/form-data", so $_FILES autoglobal array does nothing for me. I also can not change the method for the post.
Hmmm... how is the file data being stored then? Are you able to actually access the data that makes up the file itself?
getallheaders() returns an array with the following values: ("Basic cm9vdDpzYXZ5Y2F0X2Jvb3N0ZXI=", "attachment; filename=image02048.jpg", "12389", "image/jpeg", "shttpclient $Revision: 1.28 $", "a", "s"). I think the first value is the actual file data and the other values are file information. The other successful implementations for handling these uploads make the use of ASP's Request.BinaryRead and Perl's read(STDIN,$buffer, $length);