0

我想知道如何将文件夹不仅仅是文件上传到保管箱 我正在使用代码上传文件需要在其中更改以创建或上传文件夹吗?

下面你会看到upload.php


<?php 
require_once 'terceros/dropbox/vendor/autoload.php';
use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;

$dropboxKey =" your key";
$dropboxSecret =" your secret"; 

$dropboxToken=" your token";


$app = new DropboxApp($dropboxKey,$dropboxSecret,$dropboxToken);
$dropbox = new Dropbox($app);

if(!empty($_FILES)){
    $nombre = uniqid();
    $tempfile = $_FILES['file']['tmp_name'];
    $ext = explode(".",$_FILES['file']['name']);
    $ext = end($ext);
    $nombredropbox = "/" .$nombre . "." .$ext;

   try{
        $file = $dropbox->simpleUpload( $tempfile,$nombredropbox, ['autorename' => true]);
        echo "Arquivo enviado com sucesso";
   }catch(\exception $e){
        print_r($e);
        
   }



}


?>

现在 index.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>


<form action="upload.php" method="post" enctype="multipart/form-data" >


<input type="file" name="file" id="file"/>
<br>
<input type="submit" name="btnenviar" id="btnenviar" />

</form>
    
</body>
</html>

如果你想知道,我正在使用这个作曲家

作曲家需要 kunalvarma05/dropbox-php-sdk

4

0 回答 0