PHP code example of edqe / laravel-uploadthing
1. Go to this page and download the library: Download edqe/laravel-uploadthing 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/ */
edqe / laravel-uploadthing example snippets
use UploadThing\UploadThing;
$uploadThing = new UploadThing('your-api-key');
// Upload a file
$file = $request->file('file');
$uploadThing->upload($file);
// Get file list
$uploadThing->listFiles();
// Rename files
$uploadThing->renameFiles([
["fileKey" => "fileKey1", "newName" => "newName2"],
["fileKey" => "fileKey2", "newName" => "newName2"]
]);
// or
$uploadThing->renameFile(["fileKey" => "fileKey1", "newName" => "newName2"]);
// Delete files
$uploadThing->deleteFiles(["fileKey1", "fileKey2"]);
// Get file urls
$uploadThing->getFileUrls(["fileKey1", "fileKey2"]);
// Get usage stats
$uploadThing->getUsageInfo();