0

I have problem with Dropbox PHP SDK. After few minutes I have exception: 'Operation too slow. Less than 1024 bytes/sec transferred the last 10 seconds'. I suppose that it can be related with PHP config. I can upload 100MB file without problem but I can't upload larger files. I am using chunkUploader (5MB chunks) and ng-file-upload

public function store(Request $request)
{
    $chunk_number = (int)$request->input('_chunkNumber');
    $chunk_size   = (int)$request->input('_chunkSize');
    $total_size   = (int)$request->input('_totalSize');
    $file         = $request->file('file');
    $file_content = file_get_contents($file->getRealPath());
    $total_chunks = floor($total_size/$chunk_size);

    //First chunk
    if($chunk_number == 0){
        $id = Dropbox::chunkedUploadStart($file_content);
        $expires_at = Carbon::now()->addMinutes(60);
        Cache::put('id', $id, $expires_at);
    }

    //Add new chunk
    if($chunk_number > 0 && $chunk_number <= $total_chunks){
        Dropbox::chunkedUploadContinue(Cache::get('id'), $chunk_number*$chunk_size, $file_content);
    }

    //Finish upload
    if($chunk_number == $total_chunks){
        Dropbox::chunkedUploadFinish(Cache::get('id'), '/file', Dropbox\WriteMode::add());
    }
}

Stack trace: {main}
[2016-03-25 10:37:27] local.ERROR: exception 'Dropbox\Exception_NetworkIO' with message 'Error executing HTTP request: Operation too slow. Less than 1024 bytes/sec transferred the last 10 seconds' in /Users/x/Workspace/ez_api/vendor/dropbox/dropbox-sdk/lib/Dropbox/Curl.php:73 Stack trace: /Users/x/Workspace/ez_api/vendor/dropbox/dropbox-sdk/lib/Dropbox/Client.php(719): Dropbox\Curl->exec()

/Users/x/Workspace/ez_api/vendor/dropbox/dropbox-sdk/lib/Dropbox/Client.php(548): Dropbox\Client->_chunkedUpload(Array, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...')

/Users/x/Workspace/ez_api/vendor/graham-campbell/manager/src/AbstractManager.php(234): call_user_func_array(Array, Array)

/Users/x/Workspace/ez_api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(216): GrahamCampbell\Manager\AbstractManager->__call('chunkedUploadSt...', Array)

/Users/x/Workspace/ez_api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(216): GrahamCampbell\Dropbox\DropboxManager->chunkedUploadStart('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...')

/Users/x/Workspace/ez_api/app/Http/Controllers/AttachmentController.php(58): Illuminate\Support\Facades\Facade::__callStatic('chunkedUploadSt...', Array)

/Users/x/Workspace/ez_api/app/Http/Controllers/AttachmentController.php(58): GrahamCampbell\Dropbox\Facades\Dropbox::chunkedUploadStart('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...')

/Users/x/Workspace/ez_api/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(256): call_user_func_array(Array, Array)

/Users/x/Workspace/ez_api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(164): Illuminate\Routing\Controller->callAction('store', Array)

Hubert Burdach
  • 91
  • 2
  • 15

0 Answers0