PHP code example of gotipath / storage

1. Go to this page and download the library: Download gotipath/storage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gotipath / storage example snippets




$storage = new Storage('sftp', [
    'host' => 'ftp.fas.xyx.com',
    'username' => 'sftp/ftp username',
    'password' => 'sftp/ftp password',
    //if you connecting ssh
    // 'privateKey' => '/path/to/privateKey',
//            'password' => 'encryption-password',
    'port' => 22,
    'root' => '/pub',
    'timeout' => 30,
],$baseUrl='https://cdn.gotipath.com');


    $path = 'uploads/testdir';
    $config = []; // optional
    $storage->makeDirectory($path, $config);

    $storage->get($path);

    $inputFile = $_FILES['file'];

    $path = 'uploads/'.$inputFile['name'];

    $temp = $_FILES["file"]["tmp_name"];

    $storage->upload($path,$temp);