Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix code file upload #2453

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 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions 5 cookbook/doctrine/file_uploads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ object, which is what's returned after a ``file`` field is submitted::
$this->path = $this->getFile()->getClientOriginalName();

// clean up the file property as you won't need it anymore
$this->setFile(null);
$this->file = null;
}

Using Lifecycle Callbacks
Expand Down Expand Up @@ -408,7 +408,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
// the entity from being persisted to the database on error
$this->getFile()->move($this->getUploadRootDir(), $this->path);

$this->setFile(null);

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the extra 2 lines


// check if we have an old image
if (isset($this->temp)) {
Expand All @@ -417,6 +417,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
// clear the temp image path
$this->temp = null;
}
$this->file = null;
}

/**
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.