如何使用php中的框视图api上传文件

时间:2015-02-24 04:18:17

标签: php box-view-api

我正在尝试使用框视图api在php上传文件。我正在使用box-view-api GitHub

中的库

这是我的代码:

 <?php
require_once('repository_fns.php');
require 'lib/box-view-api.php';
require 'lib/box-view-document.php';

session_start();

$objid=$_GET['objid'];

$object_general=get_obj_general($objid);
$object_rights=get_obj_rights($objid);
$object_lifecycle=get_obj_lifecycle($objid);
$object_tech=get_obj_tech($objid);

do_html_header('', 'browse.css');
display_object_metadata($object_general, $object_rights, $object_lifecycle,   $object_tech);

$api_key = 'MY_KEY';
$box = new Box_View_API($api_key);

$doc = new Box_View_Document(array(
'name' => 'Geology of Canada',
'file_path' => '/uploads/Geology of Canada.docx',
));

$box->upload($doc);

display_file_page();

do_html_footer();
?>

但为什么我收到错误消息:

Fatal error: Uncaught exception 'Box_View_Exception' with message 'couldn't       open file "/uploads/Geology of Canada.docx"' in /home/ychenlucs15/public_html/lib/box-view-api.php:241 Stack trace: #0 /home/ychenlucs15/public_html/lib/box-view-api.php(456): Box_View_API->httpRequest(Array) #1 /home/ychenlucs15/public_html/show_object.php(28): Box_View_API->upload(Object(Box_View_Document)) #2 {main} thrown in /home/ychenlucs15/public_html/lib/box-view-api.php on line 241

有人能告诉我如何使用php正确实现它吗?提前谢谢。

0 个答案:

没有答案