I am using Nextcloud server implemented by wedos.cz on cd.wedos.com. So I do not have any control of the server
My thinking is that
syntax of the assembling code is not right or
there must be something set up or turned on on the server or
the doc says " The API is only available for registered users of your instance. And uses the path: /remote.php/dav/uploads/." but I use files in the url. If I use uploads then I cannot see if the temp folder was created. There is no error though. It looks like the chunks were uploaded but I cannot confirm and also there is no error returned when uploading. But the MOVE finishes with an error message “The destination node is not found”
Could someone please help me to fix this?
The code for uploading chunks
// Read the file in chunks and upload
$fp = fopen($filePath, 'rb');
$chunkNumber = 0;
$startByte = 0;
while (!feof($fp)) {
$chunk = fread($fp, $chunkSize);
$endByte = $startByte + strlen($chunk) - 1;
// Generate a unique filename based on start and end bytes
$chunkFileName = sprintf('%020d-%020d', $startByte, $endByte);
$chunkPath = $tempFolder . '/' . $chunkFileName;
// Upload the chunk
// $client->put($chunkPath, $chunk);
// // Upload the chunk
try {
$client->request('PUT', $chunkPath, $chunk);
echo "Uploaded chunk $chunkNumber successfully.\n";
} catch (Exception $e) {
echo "Error uploading chunk $chunkNumber: " . $e->getMessage() . "\n";
break; // Handle errors appropriately
}
$startByte += strlen($chunk);
$chunkNumber++;
}
fclose($fp);
The above should be /uploads/ and appears to already include a uniquely named folder for the upload embedded in it statically. You appear to be attempting to create another uniquely named folder within it below:
I don’t see anywhere you’re including the Destination header with the MKCOL request.
It also appears your PUT needs the Destination header.
if I upload to …/upload/… I cant see them but I would say they were uploaded. There was no error
So the only step for uploading a large file is to merge all the chunks.
Do you mean wedos-auth-7518fe8d-0f5f-4c87-99a2-6exxxxxxx ? It is an userId.
I am using Sabre webdav client. So the syntax is different. The directory is created - I can see it via web UI. Of course if I use …/files/ not …/uploads/
The same applies for PUT. It works. I am able to upload. But the merge.
Below is the latest version of my code. It produces another error that I described in another post . ’ Incompatible node types error’