Ejemplo n.º 1
0
function renameFile()
{
    $storage = new StorageAPIs($_SESSION['sHost'], $_SESSION['sApp'], $_SESSION['sTr']);
    $var0 = trim($_POST['var0'], " ");
    $var1 = trim($_POST['var1'], " ");
    $var2 = trim($_POST['var2'], " ");
    echo "\nRENAME FILE: \n\n";
    if (strlen($var0) == 0 || strlen($var1) == 0 || strlen($var2) == 0) {
        echo "\n Error: Empty mandatory field(s)!\n";
    } else {
        $storage->setAuthToken($var0);
        $responseObject = $storage->renameFile($var1, $var2);
        $current = $responseObject->getErrorStatus();
        if (!empty($current)) {
            echo "Error Status: \n";
            echo " Error code: " . $current->getCode() . "\n";
            echo " Error message: " . $current->getMessage() . "\n";
        } else {
            $current = $responseObject->getStatus();
            if (!empty($current)) {
                echo " Status: " . $current . "\n";
            } else {
                echo " Status: N/A\n";
            }
        }
    }
    echo "\n----------------------------------------------------------------------------------------------------\n";
}