1

I'm trying to make a php code that will automatically create a shared link for the files I'm uploading and add it to an XML file.

Both the upload and XML file are updating correctly, but I'm stuck with the generation of the link. This is the part of code that i'm running right now:

$parameters = array('path' => $filename);

$headers = array('Authorization: Bearer token','Content-Type: application/json');
$curlOptions = array(
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($parameters),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_VERBOSE => true
);

$ch = curl_init('https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings');
curl_setopt_array($ch, $curlOptions);

$linkdropbox = curl_exec($ch);
curl_close($ch);
$nodeDescargaText = $xml -> createTextNode($linkdropbox);

Filename is

$filename = "/".$_FILES['inputFile']['name'];

So, I keep getting errors like:

"The root path is unsupported"

"Malformed path"

I have tried leaving the root both with "" or with "/", and also have tried putting in the root the name of the Apps folder, (Apps, Aplicaciones, manualesint), the last one being the folder to where are the files being uploaded. None seems to make this work. I have tried all of them both with a "/" after, before, both, or without.

On the upload code, I'm uploading the file using "/"+name of the file, and it's working like a charm.

Any help will be appreciated!

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.