/**
* 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
*/
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);
// return the servlet part instance
return $servletPart;
}