2012-04-20 5 views
1

드롭 박스 php-api를 배우려고합니다. 내가 업로드를 수행하지만, 보관 용 계정에 새 폴더 (존재하지 않는 경우)php-api를 사용하여 dropbox 계정에 폴더를 생성하는 방법 (존재하지 않는 경우)?

코드 만들 수 없습니다 있습니다 :

// Create new directory 
$create_new_folder = $dropbox->createFolder('new_folder','dropbox'); 

// Create a temporary file and write some data to it 
$tmp = tempnam('/tmp', 'dropbox'); 
$data = 'This file was uploaded using the Dropbox API!'; 
file_put_contents($tmp, $data); 

// Upload the file with an alternative filename 
$put = $dropbox->putFile($tmp, 'abc.txt'); 

// Unlink the temporary file 
unlink($tmp); 

// Dump the output 
var_dump($put); 

오류 :

전화 정의되지 않은 메서드 보관 용을 \ API :: createFolder() C : \ wamp \ www \ BenTheDesigner-Dropbox-b49576c \ examples \ putFile.php on line 18

+0

오전 'BenTheDesigner - 드롭 박스'의 PHP API를 사용하여. https://github.com/BenTheDesigner/Dropbox/downloads에 링크하십시오. 내 앱 액세스 유형 '전체 보관함'. – Frank

답변

1

이 오류는 것 같습니다. 존재하지 않는 "createFolder"라는 함수를 호출하려고합니다. 함수가 실제로 단지 이름처럼

https://github.com/BenTheDesigner/Dropbox/blob/master/Dropbox/API.php

그것은 "생성"외모 :에있는 라이브러리를 확인

/** 
* Creates a folder 
* @param string New folder to create relative to root 
* @return object stdClass 
*/ 
public function create($path) 
{ 
2

단지 그것을

require_once를 ('bootstrap.php')를 사용한다;

// 새 디렉토리 만들기 $ create_new_folder = $ dropbox-> create ('docs', 'dropbox');

이제 보관 체크인 :