source/php/App.php
public function createBackup($originalPath)
    {
        // Bail if file does not exist
        if (!file_exists($originalPath)) {
            return false;
        }

        $pathinfo = pathinfo($originalPath);

        $backupPrefered = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '.' . $pathinfo['extension'] . '.bkp';
        $backupFile = $backupPrefered;

        $i = 0;
        while (file_exists($backupFile)) {
            $i++;
            $backupFile = $backupPrefered . $i;
        }

        if (copy($originalPath, $backupFile)) {
            return $backupFile;
        }

        return false;
    }
public function createBackup($originalPath)
    {
        // Bail if file does not exist
        if (!file_exists($originalPath)) {
            return false;
        }

        $pathinfo = pathinfo($originalPath);

        $backupPrefered = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '.' . $pathinfo['extension'] . '.bkp';
        $backupFile = $backupPrefered;

        $i = 0;
        while (file_exists($backupFile)) {
            $i++;
            $backupFile = $backupPrefered . $i;
        }

        if (copy($originalPath, $backupFile)) {
            return $backupFile;
        }

        return false;
    }
public function createBackup ( $ originalPath ) { // Bail if file does not exist if ( ! file_exists ( $ originalPath ) ) { return false ; } $ pathinfo = pathinfo ( $ originalPath ) ; $ backupPrefered = $ pathinfo [ 'dirname' ] . '/' . $ pathinfo [ 'filename' ] . '.' . $ pathinfo [ 'extension' ] . '.bkp' ; $ backupFile = $ backupPrefered ; $ i = 0 ; while ( file_exists ( $ backupFile ) ) { $ i ++ ; $ backupFile = $ backupPrefered . $ i ; } if ( copy ( $ originalPath , $ backupFile ) ) { return $ backupFile ; } return false ; }
Creates a backup of a media file
@param  string $originalPath The original file path
@return [type]               [description]
Creates a backup of a media file