What I'm trying to do is save the binary file sent through CURL from another server.
The php uploader I have is:
<?php
define("UPLOAD_DIR", "/tmp/");
if (!empty($_FILES["myFile"])) {
    $myFile = $_FILES["myFile"];
    if ($myFile["error"] !== UPLOAD_ERR_OK) {
        echo "<p>An error occurred.</p>";
        exit;
    }
    // ensure a safe filename
    $name = preg_replace("/[^A-Z0-9._-]/i", "_", $myFile["name"]);
    // don't overwrite an existing file
    $i = 0;
    $parts = pathinfo($name);
    while (file_exists(UPLOAD_DIR . $name)) {
        $i++;
        $name = $parts["filename"] . "-" . $i . "." . $parts["extension"];
    }
    // preserve file from temporary directory
    $success = move_uploaded_file($myFile["tmp_name"],
        UPLOAD_DIR . $name);
    if (!$success) { 
        echo "<p>Unable to save file.</p>";
        exit;
    }
    // set proper permissions on the new file
    chmod(UPLOAD_DIR . $name, 0644);
}
So i have this on my site as such:
example.com/uploader.php
On server number 2, I run the command:
curl --request POST  --data-binary "@binary.jpg"  http://example.com/uploader.php
and then I check my /tmp/ folder for the file named binary.jpg but it is not there, what is the issue here ?
Thanks.
 
     
    