We are facing an issue with the PHP SDK that previously we didn’t face with the deprecated Laravel Package.
The issue that when we create a folder and inside it files, and then we use the code example of deleteFolder, it throws this exception (attached), but when the folder is empty and have no files it didn’t throw any exception.
Please note, since Aspose.Words Cloud 19.4 version, we have integrated storage methods in Aspose.Words Cloud API. Now you do not need to use Aspose.Storage Cloud API for storage operations. Please find sample PHP code for folder deletion as follows. You may check Aspose.Words Cloud SDK for PHP for more details.
<?php
require_once('C:\xampp\htdocs\aspose-words-cloud-php-master\vendor\autoload.php');
//require __DIR__.'/../vendor/autoload.php';
use Aspose\Words\Configuration;
use Aspose\Words\WordsApi;
use Aspose\Words\Model\Requests;
//TODO: Get your AppSID and AppKey at https://dashboard.aspose.cloud (free registration is required).
$words = new WordsApi('xxxxx-xxxx-xxxx-xxxx-xxxxxxxx','xxxxxxxxxxxxxxxxxxxxxxx');
try {
$folderPath="Temp/Test";
//using default storage
$storage_name = null;
//Enable to delete folders, subfolders and files
$recursive = True;
$request = new Requests\DeleteFolderRequest($folderPath,$storage_name,$recursive);
$result = $words->deleteFolder($request);
print_r($result);
echo "Completed!!!!";
} catch (Exception $e) {
echo "Something went wrong: ", $e->getMessage(), "\n";
PHP_EOL;
}
?>