vendredi 25 mars 2016

Operation too slow. Less than 1024 bytes/sec transferred the last 10 seconds

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());
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire