Здравствуйте, как отправить файл через рукописный PHP/ Отправляю так:
ini_set('display_errors', 1); # Include the Dropbox SDK libraries require_once "lib/Dropbox/autoload.php"; use \Dropbox as dbx; $accessToken = "cBr9qwdqwdqwdqwdqwdZeUHc3YS0fYtrYA"; // Здесь ваш Access token $dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0"); if($_FILES['ya']['name']){ $f = fopen($_FILES['ya']['name'], "rb"); $fbuch=$_FILES['ya']['name']; $fbuch2="/".$fbuch; $fileMetadata = $dbxClient->uploadFile("/ChangeLog.txt", dbx\WriteMode::add(), $f); fclose($f); print_r($fileMetadata);} ... <form action="" method="POST" enctype="multipart/form-data"> <input type = "file" name = "ya" /> <input type="submit" value="Загрузить"> </form>
Выдает ошибку:
Fatal error: Uncaught exception 'InvalidArgumentException' with message ''inStream' has bad type; expecting resource, got boolean' in /var/www/v-2348/data/www/stylus.kz/lib/Dropbox/Checker.php:22 Stack trace: #0 /var/www/v-2348/data/www/stylus.kz/lib/Dropbox/Checker.php(27): Dropbox\Checker::throwError('inStream', false, 'resource') #1 /var/www/v-2348/data/www/stylus.kz/lib/Dropbox/Client.php(278): Dropbox\Checker::argResource('inStream', false) #2 /var/www/v-2348/data/www/stylus.kz/ya.php(16): Dropbox\Client->uploadFile('/Sites.txt', Object(Dropbox\WriteMode), false) #3 {main} thrown in /var/www/v-2348/data/www/stylus.kz/lib/Dropbox/Checker.php on line 22