Skip to content

Added docs for file helper #6454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

dfridrich
Copy link
Contributor

Q A
Doc fix? no
New docs? yes symfony/symfony#18502
Applies to 3.1
Fixed tickets

@xabbuh xabbuh added the On hold label Apr 11, 2016
@OskarStark
Copy link
Contributor

LGTM 👍

@wouterj
Copy link
Member

wouterj commented May 5, 2016

@OskarStark it can't be as the feature has not yet been merged (and there still is some discussion on the implementation).

@OskarStark
Copy link
Contributor

Oh sorry @wouterj , i meant the current status looks good ;-)

@xabbuh xabbuh added this to the 3.2 milestone May 21, 2016
fabpot added a commit to symfony/symfony that referenced this pull request Jun 15, 2016
…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
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jun 15, 2016
…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
File helper
~~~~~~~~~~~

If you want to serve file use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] use the [...]

@wouterj
Copy link
Member

wouterj commented Jul 8, 2016

Hi @dfridrich.

I've rebased your PR and tweaked the wording a bit (so we can remove most of the paragraph and use the code examples more) in #6732. I've kept your commit, so you'll still get the credits you deserve.

Thanks!

@wouterj wouterj closed this Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants