wide-agent-9525
07/23/2025, 10:21 AMphp
<?php
function uploadFileFromUrl($nameOfFile, $urlToFile, $knowledgeBaseId) {
global $token;
global $botId;
$postData = [
'key' => $nameOfFile,
'url' => $urlToFile,
'index' => true,
'accessPolicies' => [],
'tags' => [
'source' => 'knowledge-base',
'kbId' => $knowledgeBaseId,
'title' => $nameOfFile
],
'size' => strlen(file_get_contents($urlToFile))
];
return fetch("https://api.botpress.cloud/v1/files", [
'method' => 'PUT',
'headers' => [
"Authorization: Bearer $token",
"Accept: application/json",
"Content-Type: application/json",
"x-bot-id: $botId"
],
'body' => json_encode($postData)
]);
} but whenever I upload a file like this inside knowledge base it appears with loader nearby and I can't preview it nor do anything about this file. When i uploaded this same files from node.js from my pc it worked perfectly fine. Does anybody know what is happening?
Also: I had tested uploading big file (12mb xml file renamed to .html) that is kind of sitemap that contains info from each page and I had uploaded it in studio editor 33 minutes ago and similar to php upload it has this spinner and nothing else happens
https://cdn.discordapp.com/attachments/1121494527727902891/1397524015937228830/image.png?ex=6882092a&is=6880b7aa&hm=261f4add2ee752dce3a853ffad19df12b9ccd5d7e5663b32600d6b2b35ef3c88&
https://cdn.discordapp.com/attachments/1121494527727902891/1397524016293478482/image.png?ex=6882092a&is=6880b7aa&hm=426ac534486099cf9783ba9aeb1c689f1ef63f88e28341b14a2fbed48fc6bbbd&