1
我有一個文件夾內,並在該文件夾4個文件,我想將所有文件從該文件夾到收存箱文件夾上傳。如何從一個文件夾上傳multiplle文件到收存箱文件夾
我怎樣才能做到這一點?
下面是我的代碼:
$ch = curl_init();
$TOKEN = "token";
$url = 'https://content.dropboxapi.com/2/files/upload';
$cron_log = site_url().'/foldername';
$fp = fopen($cron_log, 'rb');
$size=filesize($cron_log);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = 'Content-Type:application/octet-stream';
$headers[] = 'Dropbox-API-Arg:{"path":"/home/test/address_proof.pdf","mode":{".tag":"add"},"autorename":false,"mute":false}';
$headers[] = "Authorization: Bearer ".$TOKEN;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($ch, CURLOPT_HTTPHEADER, $cheaders);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, $size);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$droplist = json_decode($response,true);
Thanks.its工作 – Reshma