We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Delete a storage folder in PHP using Aspose.Storage REST API issue

Hello Aspose Support,

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.

Also we tried with the flag of recursive and without it, and same exception happens.screenshot_from_2018-03-05_10-04-55.png (26.9 KB)

Let us know if you need more details to replicate the issue.



Thank you for contacting Aspose Support.

Problem is not with the delete /storage/folder API. Following Postman example successfully delete the folder with files.


We are testing Aspose.Storage Cloud SDK for PHP for the reported issue and will update you shortly about our findings.


The issue has been fixed. Please download aspose/storage-sdk-php package version 1.0.1.


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.


//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 {	
	//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);
    echo "Completed!!!!";
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";