Re: SV: [PHP] Sending files via POST
| From: | Nathan Rixham | Date: | Thu, 01 Jan 2009 14:35:40 +0000 |
| Subject: | Re: SV: [PHP] Sending files via POST | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285344@lists.php.net to get a copy of this message | ||
Anders Norrbring wrote:
after having a flick through the source it looks like a limitation of http request; http://pear.php.net/package/HTTP_Request/docs/latest/__filesource/fsource_HTTP_Request__HTTP_Request-1.4.4Request.php.html check lines around 600 and 900+ you'd have to set the http request yourself i thinks! (setBody) may be worth contacting they who maintain the packageOn Thu, Jan 1, 2009 at 02:35, Anders Norrbring <anders@norrbring.se> wrote:Absolutely true, but the receiving end is expecting the data as a file upload.I'm a bit stuck.. I'm using the PEAR http_Request to send files anddata asHTTP POST, which is working fine if I in fact have the files on diskon theserver. Just using the method addFile..Okay....But what if the file data is only in a variable? It feels likeoverkill tofirst save to disk, and then read it in with addFile... The HTTP POSTI'mlooking at will need to add "files" both from disk and variables..... then it's not a file, it's data held in RAM (non-TSR).Are you looking to stream the file content (such as the header or initial $n bytes) from you local system to the server? If so, sorry, but you're in the wrong place.I don't really understand what you're asking for above, but to try to explain... My server is to create a HTTP POST request to another system, with a couple of "form variables" and also 2-3 "files". Much like a manual html form will do, but with no human intervention.Well, some of the "form values" are static, like user name etc. Then one file will be static (and stored on disk as a file) and added with method 'addData' to the POST request. Another "file" is generated dynamically from data stored in a SQL database and data provided by user input from visiting my site. Of course I can store this dynamically generated data to disk, add it with 'addData' and then delete it after the request is made, but it doesn't really feel like the right thing to do. Anders.Ideas are welcome..My idea is to ask the question: how is the "file data" gettinginto the "variable"?