Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #18502 [FrameworkBundle] Add file helper to Controller (dfrid…
…rich) This PR was squashed before being merged into the 3.2-dev branch (closes #18502). Discussion ---------- [FrameworkBundle] Add file helper to Controller | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | symfony/symfony-docs#6454 I think it would be more "sexy" to serve files from controller easier (like `json()` helper does). **This Controller helper allows user to serve files to Response in these ways:** * pass `Symfony\Component\HttpFoundation\File` (or `Symfony\Component\HttpFoundation\UploadedFile`) instance * [REMOVED] provide content as `string` and specify file name (mime type will be auto recognized) * provide path to file (you are still able to specify other than original file name) **Examples** return $this->file($uploadedFile); // ...or... return $this->file('/path/to/my/picture.jpg'); Commits ------- d9a8499 [FrameworkBundle] Add file helper to Controller
- Loading branch information
Showing
2 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters