PHP code example of meteopark / ncloud-object-storage-laravel

1. Go to this page and download the library: Download meteopark/ncloud-object-storage-laravel 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/ */

    

meteopark / ncloud-object-storage-laravel example snippets





namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Meteopark\NcloudObjectStorage\NOSFileUpload;

class FileUploadController extends Controller
{

    public function file(Request $request)
    {
        // $request->files has array ( = files[] )

        $files = (new NOSFileUpload(
                        time(), // default Str::Random(30)
                        "afolder/bfolder",
                        ['png','pdf']
                     ))->move($request->files);
    }
}
 

 [
     {
         "org_name": "KakaoTalk_Photo_2019-05-20-18-13-15.png",
         "path": "afolder/bfolder/1559182454.png",
         "mime_type": "image/png",
         "image": {
             "width": 296,
             "height": 40
         }
     },
     {
          "org_name": "test2.pdf",
          "path": "afolder/bfolder/1559182454.pdf",
          "mime_type": "application/pdf",
     }
 ]