I am using an http Client with Symfony. In this example I am creating a folder.
$client = HttpClient::create();
/* @var $response ResponseInterface */
$createFolder = $client->request('MKCOL', $filePath, [
'auth_basic' => [$user, $authKey],
]);
This works well.
Now I want to rename a folder:
$renameFolder = $client->request('MOVE', $filePath, [
'auth_basic' => [$user, $authKey],
]);
But what I cannot figure out is, where do I define the new folder name?
You seem to be accessing a Webdav server, from the MKCOL
command.
If you want to use MOVE
, the destination should be passed on a Destination
header, as shown here.
With Symfony Http Client, the request would be something like:
$moveCollection = $client->request('MOVE', $collectionPath,
[
'auth_basic' => [$user, $authKey],
'headers' => [
'Destination' => $newCollectionPath
]
]
);