Jump to content

Upload To Api Help


absorr
 Share

Recommended Posts

Please help, it is not working. I'm trying to upload a .jar onto it. The console says it received the error page where the contents of the jar should be. it is uploading, I know that because it went into my directory upload.php <?php if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; move_uploaded_file($_FILES["file"]["tmp_name"], "plugins/" . $_FILES["file"]["name"]); echo "Stored in: " . "plugins/" . $_FILES["file"]["name"]; $a_str = array($_FILES["file"]["name"]); $contents = implode(PHP_EOL, $a_str); $contents .= PHP_EOL . PHP_EOL; print("|$contents|"); $lines = file("http://games.absorr.pcriot.com/JSONAPI/plugins/{$_FILES['file']['name']}"); foreach($lines as $line); echo $lines; echo "debug 2"; require('JSONAPI.php'); // get this file at: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php $api = new JSONAPI("174.101.159.155", 20059, "absorr", "PASSWORD CENSORED FOR FORUM", " SALT CENSORED FOR FORUM"); var_dump($api->call("setFileContents", array("{$_FILES['file']['name']}", $lines))); echo "Debug 3"; }?>

Link to comment
Share on other sites

Don't use the HTTP path to read the file, use the same path that you used when you saved the file. The foreach loop also isn't doing anything, the semicolon after it makes it an empty loop. And these lines: $a_str = array($_FILES["file"]["name"]);$contents = implode(PHP_EOL, $a_str); Do the same as this: $contents = $_FILES["file"]["name"];

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...