src/Graviton/FileBundle/Manager/RequestManager.php
private function extractFileFromString($fileContent, $originalFileName = null)
    {
        $tmpName = $fileName = uniqid(true);

        if (!is_null($originalFileName)) {
            $fileName = $originalFileName;
        }

        $dir = ini_get('upload_tmp_dir');
        $dir = (empty($dir)) ? sys_get_temp_dir() : $dir;
        $tmpFile = $dir . DIRECTORY_SEPARATOR . $tmpName;

        // create temporary file;
        (new Filesystem())->dumpFile($tmpFile, $fileContent);
        $file = new File($tmpFile);

        return new UploadedFile(
            $file->getRealPath(),
            $fileName,
            $file->getMimeType(),
            $file->getSize()
        );
    }
private function extractFileFromString($fileContent, $originalFileName = null)
    {
        $tmpName = $fileName = uniqid(true);

        if (!is_null($originalFileName)) {
            $fileName = $originalFileName;
        }

        $dir = ini_get('upload_tmp_dir');
        $dir = (empty($dir)) ? sys_get_temp_dir() : $dir;
        $tmpFile = $dir . DIRECTORY_SEPARATOR . $tmpName;

        // create temporary file;
        (new Filesystem())->dumpFile($tmpFile, $fileContent);
        $file = new File($tmpFile);

        return new UploadedFile(
            $file->getRealPath(),
            $fileName,
            $file->getMimeType(),
            $file->getSize()
        );
    }
private function extractFileFromString ( $ fileContent , $ originalFileName = null ) { $ tmpName = $ fileName = uniqid ( true ) ; if ( ! is_null ( $ originalFileName ) ) { $ fileName = $ originalFileName ; } $ dir = ini_get ( 'upload_tmp_dir' ) ; $ dir = ( empty ( $ dir ) ) ? sys_get_temp_dir ( ) : $ dir ; $ tmpFile = $ dir . DIRECTORY_SEPARATOR . $ tmpName ; // create temporary file; ( new Filesystem ( ) ) -> dumpFile ( $ tmpFile , $ fileContent ) ; $ file = new File ( $ tmpFile ) ; return new UploadedFile ( $ file -> getRealPath ( ) , $ fileName , $ file -> getMimeType ( ) , $ file -> getSize ( ) ) ; }
Extracts file data from request content

@param string $fileContent      the file content
@param string $originalFileName an overriding original file name

@return false|UploadedFile
Extracts file data from request content