public static function fromHttpRequest(PartInterface $httpPart)
    {

        // create a temporary filename
        $httpPart->write($tmpFilename = tempnam(ini_get('upload_tmp_dir'), 'tmp_'));

        // initialize the servlet part instance
        $servletPart = new Part();
        $servletPart->setName($httpPart->getName());
        $servletPart->setFilename($httpPart->getFilename());
        $servletPart->setTmpFilename($tmpFilename);

        // initialize the headers the the size
        $servletPart->headers = $httpPart->getHeaders();
        $servletPart->size = $httpPart->getSize();

        // return the servlet part instance
        return $servletPart;
    }
public static function fromHttpRequest(PartInterface $httpPart)
    {

        // create a temporary filename
        $httpPart->write($tmpFilename = tempnam(ini_get('upload_tmp_dir'), 'tmp_'));

        // initialize the servlet part instance
        $servletPart = new Part();
        $servletPart->setName($httpPart->getName());
        $servletPart->setFilename($httpPart->getFilename());
        $servletPart->setTmpFilename($tmpFilename);

        // initialize the headers the the size
        $servletPart->headers = $httpPart->getHeaders();
        $servletPart->size = $httpPart->getSize();

        // return the servlet part instance
        return $servletPart;
    }
public static function fromHttpRequest ( PartInterface $ httpPart ) { // create a temporary filename $ httpPart -> write ( $ tmpFilename = tempnam ( ini_get ( 'upload_tmp_dir' ) , 'tmp_' ) ) ; // initialize the servlet part instance $ servletPart = new Part ( ) ; $ servletPart -> setName ( $ httpPart -> getName ( ) ) ; $ servletPart -> setFilename ( $ httpPart -> getFilename ( ) ) ; $ servletPart -> setTmpFilename ( $ tmpFilename ) ; // initialize the headers the the size $ servletPart -> headers = $ httpPart -> getHeaders ( ) ; $ servletPart -> size = $ httpPart -> getSize ( ) ; // return the servlet part instance return $ servletPart ; }
Creates a new servlet part instance with the data from the HTTP part.

@param \AppserverIo\Psr\HttpMessage\PartInterface $httpPart The HTTP part we want to copy

@return \AppserverIo\Appserver\ServletEngine\Http\Part The initialized servlet part
Creates a new servlet part instance with the data from the HTTP part .