php - sending a file to slimframework from nodejs server -


I want to send a file to my other API on another server from my server but for some reason it can not be found The data I have sent ..

Using the rest of the API php slim framework:

  $ app-> Use the post ('/ api / upload', function () ($ app)) {$ logs = '/ home / logs'; // error_log (print_r ($ _ files, 1), 3, $ log. '/export16.log') {$ data = file_get_contents ('php: // input'); // EMPTY !!!! Error_log (print_r (calculate ($ data), 1), 3, $ log. '/export16.log')}} hold (exception $ e) {error_log (print_r ($ data, 1), 3, $ log. ' /export16err.log ');}});   

Nodes using the request module:

  fs.createReadStream ('myfile.zip') .pipe (request.post (UPLOAD_URL, function (error , Reaction, body) {//console.log(response); if (! Error and response.statusCode == 200) {//console.log(repons);}}));   

Also attempted with this code: Use the form-data module explained in documents

  var r = request.post (UPLOAD_URL, function Alternative callback, httpResponse, body) {if (err) {return console.error ('upload failed:', err);} console.log (httpResponse); Console.log ('successful! Server responded:', body); }) Var form = r.form (); Form.append ('my_file', fs.createReadStream ('file.zip'));   

They both do not work and I do not get data in my php: input, I look at the header content type: application / zip set, but nothing else Do not miss the thing?

  _header: 'POST / API / uploads HTTP / 1.1 \ r \ nhost: xyz.com \ r \ ncontent-type: a document / zip \ r \ nconnection: keep-alive \ R \ nTransfer-Encoding: Selected \ r \ n \ r \ n ',   

Any ideas what I am doing wrong?

I have to set the length of the content when it is turned on :)

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -