php - How to forward the post file to an other server to the same script -


i have following script

    <?php   $target_path = $_server[document_root]."/files/cache/";   $target_path = $target_path . basename( $_files['uploadedfile']['name']);   if(move_uploaded_file($_files['uploadedfile']['tmp_name'], $target_path)) {      echo "the file ". basename( $_files['uploadedfile']['name'])." has been uploaded";  } else{      echo "there error uploading file, please try again!";  }  ?>  

i modify so, file uploaded on server , script on server calls script, can see here, on server b, because can't call script directly.

how can like? on server b, it's clear, use top script. have think script on server a.

i think have call script on server b server function file_get_contents(...)

    <?php   $target_path = $_server[document_root]."/files/cache/";   $target_path = $target_path . basename( $_files['uploadedfile']['name']);   if(move_uploaded_file($_files['uploadedfile']['tmp_name'], $target_path)) {      echo "the file ". basename( $_files['uploadedfile']['name'])." has been uploaded";  } else{      echo "there error uploading file, please try again!";  } //start upload server  b file_get_contents("http://server2.com/upload.php");  //... //but here have add post data-file ?>  

but how parse post-file using file_get_contents() or else?

you cannot code files server. may have change logic , use ajax.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -