Export the file as attached file by HTTP

@param string $name (optionnal)
@throws OdfException
@return void
767969
public function exportAsAttachedFile($name = "")
    {
        $this->_save();
        if (headers_sent($filename, $linenum)) {
            throw new OdfException("headers already sent ($filename at $linenum)");
        }
        
        if ($name == "") {
            $name = md5(uniqid()) . ".odt";
        }
        
        header('Content-type: application/vnd.oasis.opendocument.text');
        header('Content-Disposition: attachment; filename="'.$name.'"');
        readfile($this->tmpfile);
    }
400202
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
    {
        respondWith(response()->streamDownload($callback, $name, $headers, $disposition ));
    }
35555
public static function export($name)
    {
        $now = time();
        //
        $tables = self::tables();
        //
        $query = self::time($now).self::info();
        $query .= self::database();
        $query .= self::fetch($tables);
        //
        $file = ($name ?: config('database.database').'_'.$now).'.sql';
        //
        self::file($file);
        //
        self::save($file, $query);
        //
        return true;
    }
1275460
public function file(string $name): ?UploadedFileInterface
    {
        $array = $this->serverRequest->getUploadedFiles();

        return $array[$name] ?? Arrays::get($array, $name);
    }
1292822
public function package($name)
    {
        if (starts_with($name, 'src')) {
            $name = str_replace('src/', '', $name);
        }
        $basePath   = rtrim($this->app->make('path.base'), '/');
        $vendorPath = "{$basePath}/src";
        $paths      = [
            "{$vendorPath}/{$name}/resources/database/migrations/",
            "{$vendorPath}/{$name}/database/migrations/",
            "{$vendorPath}/{$name}/migrations/",
        ];
        foreach ($paths as $path) {
            if ($this->app->make('files')->isDirectory($path)) {
                $this->run($path);
            }
        }
        $seeds = [
            "{$vendorPath}/{$name}/resources/database/seeds/",
            "{$vendorPath}/{$name}/database/seeds/",
            "{$vendorPath}/{$name}/seeds/",
        ];
        $this->seed($name, $seeds);
    }
711926
public function load($name)
    {
        if (null === ($path = $this->path($name)))
            return;
        if ($this->fileExists && (!file_exists($path))) {
            return;
        }
        include_once $path;
    }
1186285
public function save($name = 'invoice.pdf')
    {
        $invoice = $this->generate();

        Storage::put($name, $invoice->pdf->output());
    }
264785
public function extension($name)
    {
        $paths = $this->getPaths($name);
        $files = $this->app->make('files');
        foreach ($paths as $path) {
            if ($files->isDirectory($path)) {
                $this->run($path);
            }
        }
        $this->seed($name);
    }
448629
public function appendToCurrent($name)
    {
        if ($this->current !== '') {
            $this->current .= '\\';
        }
        $this->current .= $this->lastPart = $name;
    }
516232
public function download($sFilename = '', $aOptions = [])
    {
        $sFilename = $sFilename ? $sFilename : self::DEFAULT_FILE_NAME;

        //  Set the content attachment, by default send to the browser
        $aOptions['Attachment'] = 1;

        $this->oDomPdf->render();
        $this->oDomPdf->stream($sFilename, $aOptions);
        exit();
    }
1328228
public function generateRequest($name)
    {
        if (!$content = $this->getRequestContent($name)) {
            return '';
        }

        $path = app_path('Http/Requests/'.implode('/', $this->sectionSegmentsStudly).'/'.studly_case($name).'.php');

        if (is_file($path)) {
            return '';
        }

        $this->createMissingDirs($path);

        return file_put_contents($path, $content) !== false ? $path : '';
    }
1070226
protected function registerAttachment($name, $options)
	{
		$options = $this->mergeOptions($options);
		App::make('AttachmentValidator')->validateOptions($options);
		
		$attachment = App::make('Attachment', array('name' => $name, 'options' => $options));
		$attachment->setInstance($this);
		$this->attachedFiles[$name] = $attachment;
	}
1006363
public function moveToTrash($name)
    {
        if (file_exists(route()->com.$name)) {
            (new Files())->moveDir(route()->com, route()->storage_data.'com', $name);
        }
    }
173283
public static function createMigration(string $name): void
    {
        $directory = Application::getApplicationPath('migrations');

        if (!is_dir($directory)) {
            Directory::mkdir($directory, 0755);
        }

        $timestamp = time();
        $className = Util::camelCase($name, null, false);
        $phpClassName = "Migration_{$timestamp}_{$className}";
        $fileName = "{$timestamp}_{$className}.php";
        $fullPath = Application::getApplicationPath("migrations/{$fileName}");

        $migrationFileContent = file_get_contents(__DIR__ . '/MigrationTemplate.php');
        $migrationFileContent = str_replace('templateClassName', $phpClassName, $migrationFileContent);
        $migrationFileContent = str_replace('templateClassGenerated', date('r'), $migrationFileContent);

        if (file_put_contents($fullPath, $migrationFileContent) === false) {
            throw new Application\Exception("Unable to write to migration file on path={$fullPath}");
        }

        Log::info("Created DB migration with name: {$name}");
        Log::info("You may now open application/migrations/{$fileName} and add your migration code");
    }
735690
public static function export($className, $name, $return = false)
    {
        $export = new self($className, $name);
        $export = (string)$export;
        if ($return === true) {
            return $export;
        } else {
            echo $export;

            return null;
        }
    }
1135815
public function moveFileFromTmp($name)
    {
        $baseTmpPath = $this->getBaseTmpPath();
        $basePath = $this->getBasePath();

        $baseFilePath = $this->getFilePath($basePath, $name);
        $baseTmpFilePath = $this->getFilePath($baseTmpPath, $name);

        try {
            $this->coreFileStorageDatabase->copyFile(
                $baseTmpFilePath,
                $baseFilePath
            );
            $this->mediaDirectory->renameFile(
                $baseTmpFilePath,
                $baseFilePath
            );
        } catch (\Exception $e) {
            throw new LocalizedException(
                __('Something went wrong while saving the file(s).')
            );
        }

        return $name;
    }
1373109
public function export(string $name)
    {
        $url = self::$base_url.'/'.$name.'/get';

        return self::$curl->get($url);
    }