Skip to content

Commit

Permalink
Pass $path by reference in media.file.upload event (#4612)
Browse files Browse the repository at this point in the history
Credit to @pavelmgn
  • Loading branch information
pavelmgn authored and Luke Towers committed Sep 10, 2019
1 parent 0b3db09 commit 868c7ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/backend/widgets/MediaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1576,18 +1576,18 @@ protected function checkUploadPostback()
*
* Example usage:
*
* Event::listen('media.file.upload', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path, (\Symfony\Component\HttpFoundation\File\UploadedFile) $uploadedFile) {
* Event::listen('media.file.upload', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) &$path, (\Symfony\Component\HttpFoundation\File\UploadedFile) $uploadedFile) {
* \Log::info($path . " was upoaded.");
* });
*
* Or
*
* $mediaWidget->bindEvent('file.upload', function ((string) $path, (\Symfony\Component\HttpFoundation\File\UploadedFile) $uploadedFile) {
* $mediaWidget->bindEvent('file.upload', function ((string) &$path, (\Symfony\Component\HttpFoundation\File\UploadedFile) $uploadedFile) {
* \Log::info($path . " was uploaded");
* });
*
*/
$this->fireSystemEvent('media.file.upload', [$filePath, $uploadedFile]);
$this->fireSystemEvent('media.file.upload', [&$filePath, $uploadedFile]);

$response = Response::make([
'link' => MediaLibrary::url($filePath),
Expand Down

0 comments on commit 868c7ec

Please sign in to comment.