php - Time-out error uploading file using Dropbox API -
i try upload file dropbox using api , php. thats code:
require_once "dropbox/lib/dropbox/autoload.php"; use \dropbox dbx; $appinfo = dbx\appinfo::loadfromjsonfile("app_info.json"); $csrftokenstore = new dbx\arrayentrystore($_session, 'dropbox-auth-csrf-token'); $webauth = new dbx\webauth($appinfo, "noteboxapp/0.01", "http://localhost/notes", $csrftokenstore, null); $title=$_post["titulo"].".txt"; $nota=$_post["conteudo"]; $accesstoken=$_session["token"]; $clientidentifier=$_session["userid"]; $client= new dbx\client($accesstoken, $clientidentifier); $file = fopen($title, "w") or die("unable open file!"); fwrite($file, $nota); $stat = fstat($file); $size = (int) $stat['size']; $dropboxpath="/aplicativos/notes01"; try{ $metadata = $client->uploadfile($dropboxpath, dbx\writemode::add(), $file, $size); } catch(exception $e) { echo "exceção: ", $e->getmessage(), "\n"; } fclose($file);
i exception
error executing http request: operation slow. less 1024 bytes/sec transferred last 10 seconds
i cant see why! using xampp on localhost!... in advance help!
i found solution:
i can't upload file open in "write" mode!
i have close file first open again in "read" mode , works.
Comments
Post a Comment